I spent a silly amount of time today (about 60 minutes) restoring grub to boot WinXP after my wife installed Windows7 on to her relatively new PC. I suspect a faux-pas on my part complicated the recovery.
**Some background **
Her PC has an IDE drive and a SATA drive.
- WinXP is on sda1 of the IDE drive, and sda2 on the IDE drive is an extended partition, inside which is an NTFS storage area. sda1 was the active partition on this drive.
- NTFS storage is on the sdb1 of the SATA drive, and sda2 on the SATA is an extended partition, inside which is sda5, sda6, and sda7 which are swap, / , and /home of openSUSE-11.3. sda2 was the active partition on this drive. Also, the SATA drive was the default boot drive in BIOS.
sda and sdb are as âassignedâ by openSUSE-11.4. She decided to install Windows7 on sdb1 of the SATA drive.
**Backup MBR with dd **
Before she installed, I backed up the MBR for both sda and sdb using the dd command and copied it to a memory stick. I also booted to parted magic liveCD and changed the 1st partition on the SATA drive to be the active drive (in preparation for the Win7 install on the 1st partition of the SATA).
Install win7
During Win7 install she chose âcustomâ and was careful to install Win7 on the 1st partition of the SATA drive (which is the openSUSE-11.3 /sda1). Installation of Win7 went reasonably ok (for windows) although she had no network and no audio after installing. I managed to dig out the motherboard CD and after installing drivers from there she got the network and audio working. Default win7 graphics were horrible on Win7 (with her nVidia G210) but after digging out the custom CD that came with her graphic card and installing graphics drivers from there, the graphics were âpassableâ (albeit more Win7 tuning needed as openSUSE-11.3 still looks MUCH nicer than Win7).
**restore MBR - the fun starts **
Then we booted back to the parted magic liveCD with the intention of me restoring the MBR from my MBR backups (such that the Linux grub boot manager would run, giving my wife a choice to boot: WinXP, or Win7, or openSUSE). Now it is VERY IMPORTANT to note that winXP is still her main partition where she does ALL of her work. If I lose winXP, my life expectancy on this planet would be severely curtailed.
Before doing anything, I made additional backups of the post win7 install MBR for both drives (which as it turned out I never used).
But to my horror parted magic âmayâ have labeled the SATA as sda and the IDE as sdb. I say âmayâ because I was not sure at the time. Now this would not be so serious, except I could not remember if openSUSE had labeled the SATA as sda or sdb. And of course, the name I gave to the backup MBR files did not help ⌠Duuhhhhhh ⌠MAJOR faux-pas on my part , as I know I have the worldâs worst memory and I should take more care.
So I flipped a coin, and in parted magic, I copied the backup sda MBR (which I thought was the openSUSE sata, but was not (it was the IDE)) to sda drive of parted magic (which turns out was the SATA drive MBR). ie I put the wrong MBR on the wrong drive. I made the SATA extended partition the active partition, and rebooted.
I figured if I got the MBRs mixed up the PC would simply not boot, and I would know.
Well, the PC booted immediately to openSUSE Linux (YES ! I was happy) and when I selected the windows entry in grub (which used to be winXP) Windows7 booted. My wife was NOT happy. She did NOT want to lose winXP.
After 30 minutes of playing with mappings and a number of reboot tests (with my wife leaning over my shoulder), I could easily boot to openSUSE-11.3 and Win7, but NOT to winXP. Win7 kept coming up each time I tried to boot to winXP. Visions of Win7 destroying the winXP boot danced through my head, and ominous looks from my wife (containing daggers) were bouncing off my already thin skin.
**restore MBR again !! **
Finally, I decided to swap the MBRs of sda and sdb from my 1st set of MBR backups. But my wifeâs patience was almost gone now (at about minute 50), so as to avoid my wife being charged with my homicide, we booted to BIOS and made the IDE drive the default drive (as the IDE drive has winXP on it). WinXP booted. Suddenly my wife was not so willing to commit a capital offence.
I was allowed to put the SATA back (in BIOS) as the default drive, so I could fix the grub boot manager.
So I booted to openSUSE, and put grub back to its previous mapping (removing my zillion speculative unsuccessful hacks) and ensured I had a good rootnoverify setting in the menu.lst for winXP.
Rebooted, and once again it worked. We could get winXP ! ⌠whewwww âŚ
The wifeâs looks of daggers changed to hearts and once again I was saved.
Some time I need to learn how this really works.
But its just another day in the oldcpu household, although sometimes I think Iâm too old to have this marital stress.