My wife installed Windows7 on a PC with openSUSE-11.4 already installed, managing to keep both openSUSE-11.4 and WinXP. This blog discusses what we did as part of this installation.
First, some detail on the hard drive content on my wife’s PC … it has two hard drives: one is a SATA drive and the second is an IDE drive. My wife already had on that PC:
- Windows7 home trial version on 1st partition of SATA drive [where trial has expired so this is not used]
- openSUSE-11.4 partitions on the extended/logical partitions of SATA drive
- Windows XP on IDE drive 1st partition
- NTFS data partition on IDE drive
The PC uses the openSUSE-11.4 legacy grub as the boot manager.
Her plan was to replace the existing Windows7 home on the SATA with a version of Windows7 professional that she recently purchased.
Backups
Before installing my wife ensured she had data backups. That took no time as she is very good at keeping backups on an external hard drive.
Then we booted to openSUSE-11.4 and I ran some programs to:
- backup the sata drive MBR before installing Windows7
- categorize her boot manager and partitioning setups so that we understood everything
First, I ran the follow command as a regular user to see what partitions she normally mounts in openSUSE-11.4
df -Th
which yielded:
Filesystem Type Size Used Avail Use% Mounted on
rootfs rootfs 25G 5.9G 18G 25% /
devtmpfs devtmpfs 2.9G 268K 2.9G 1% /dev
tmpfs tmpfs 3.0G 3.7M 2.9G 1% /dev/shm
/dev/sda6 ext4 25G 5.9G 18G 25% /
/dev/sda7 ext4 202G 119G 73G 63% /home
/dev/sdb1 fuseblk 196G 29G 167G 15% /windows/winXPide
/dev/sdb5 fuseblk 271G 79G 193G 29% /windows/data-ide
/dev/sda1 fuseblk 235G 103G 132G 44% /windows/E
Since I knew openSUSE was on the SATA drive, this showed that the sata drive was known as ‘sda’ and that partitions sda6 ( / ), sda7 ( /home ) were allocated to GNU/Linux. The sda1 ( /windows/E ) was her existing unused expired Windows7 home, and that was what she intended to replace. Her WindowsXP was on /sdb1 and she had a data partition (formatted as NTFS) on her /windows/data-ide (the formatting was not obvious with this view).
Then I ran the following command with root permissions to check all partitions:
fdisk -l
which yielded
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4f424a0d
Device Boot Start End Blocks Id System
/dev/sda1 63 491733584 245866761 7 HPFS/NTFS/exFAT
/dev/sda2 * 491739136 976773119 242516992 f W95 Ext'd (LBA)
/dev/sda5 491741184 495941631 2100224 82 Linux swap / Solaris
/dev/sda6 495943680 548378623 26217472 83 Linux
/dev/sda7 548380672 976736255 214177792 83 Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a95c3
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 409593239 204796588+ 7 HPFS/NTFS/exFAT
/dev/sdb2 409593240 976768064 283587412+ f W95 Ext'd (LBA)
/dev/sdb5 409593303 976766975 283586836+ 7 HPFS/NTFS/exFAT
Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe8e6ba83
Device Boot Start End Blocks Id System
/dev/sdc1 * 63 976768064 488384001 7 HPFS/NTFS/exFAT
The presence of sdc1 surprised me ! I took a look and my wife still had an external hard drive plugged in. When I commented on that, she noted she had forgotten to unplug it.
The fsdisk command was consistent with the assessment as to sda and sdb as to where the Windows7, openSUSE-GNU/Linux, Windows-XP, and IDE data partition were located. MOST important was the information that the active partition on sda (the SATA drive, where my wife intended to install Windows7 Pro) was sda2, the extended partition.
I also checked her openSUSE menu.lst (which I won’t repeat here) to see what it had for booting. There was nothing unusual there, other than perhaps the mapping for windowsXP, which I won’t go into (and will be clear from the findgrub command below).
Then as a final check into her grub information, as a regular user I ran a script from please_try_again’s ‘updategrub’ package, where that script is called ‘findgrub’ . One can find that updategrub script by a simple search.
findgrub
to which I was prompted for the root password and after entering that password I was presented with this:
Find Grub Version 3.5.1 - Written for openSUSE Forums
- reading MBR on disk /dev/sda ...
- searching partition /dev/sda1 (NTFS) ... --> Windows7/Vista Loader found in /dev/sda1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :
###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda1
rootnoverify (hd0,0)
chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- reading bootsector /dev/sda2 * (Extended) ... --> Legacy GRUB found in /dev/sda2 => sda6 0x83 (openSUSE)
- skipping partition /dev/sda5 (swap)
- reading bootsector /dev/sda6 (LINUX) ...
- reading bootsector /dev/sda7 (LINUX) ...
- reading MBR on disk /dev/sdb ...
- searching partition /dev/sdb1 * (NTFS) ... --> Windows NT/2K/XP Loader found in /dev/sdb1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :
###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sdb1
rootnoverify (hd1,0)
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- reading bootsector /dev/sdb2 (Extended) ...
- searching partition /dev/sdb5 (NTFS) ...
- reading MBR on disk /dev/sdc ...
- searching partition /dev/sdc1 * (NTFS) ... --> Windows7/Vista Loader found in /dev/sdc1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :
###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sdc1
rootnoverify (hd?,0)
map (hd?) (hd0)
map (hd0) (hd?)
chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Again, the external drive being plugged in (sdc1) can be ignored. This also illustates that sda2 is the active partition on the SATA drive, and illustrates that Legacy GRUB found in /dev/sda2 => sda6
**Backup MBR **
Next, while running openSUSE-11.4, I backed up the Master Boot Record (MBR) of both her sata (sda) and ide (sdb) drives just in case Windows7 were to over write them. to do that backup, I opened a terminal, typed ‘su’ to get root permissions, and then:
to backup ‘sda’ I typed:
dd if=/dev/sda of=MBR-sda-before-win7-440 bs=440 count=1
which created the file MBR-sda-before-win7-440.
and to backup ‘sdb’ I typed:
dd if=/dev/sdb of=MBR-sdb-before-win7-440 bs=440 count=1
which created the file MBR-sdb-before-win7-440.
This backed up the MBR boot information minus the partitioning information. Of note is this backup does NOT backup/record which partition is active.
Note it is INCREDIBLY important to get those command EXACT. GNU/Linux is full of stories/legends of GNU/Linux guru’s who messed up that command and broke their system boot. One needs absolute precision.
I copied the files MBR-sda-before-win7-440 and MBR-sdb-before-win7-440 to a USB stick. Note MBR-sdb-before-win7-440 was not needed but I was being conservative, in case of mixing up sda and sdb in a minute of blindness (I’ve done such a silly mistake before). Hence I had a copy of both MBRs.
… continued …