Restoring GRUB
Stuart Murray-Smith
eight32 at gmail.com
Fri Oct 9 11:30:04 UTC 2009
Greets list :)
We require automating an image solution for a lab of dual-booting
Ubuntu 9.04 && Windows desktops, all goes well except we resort to
restoring GRUB manually.
We intend to install Windows first, Ubuntu second, && use Ubuntu's
GRUB as boot manager. The drive structure is such:
/dev/sda1 == NTFS/Windows
/dev/sda2 == swap
/dev/sda3 == Ext3/Ubuntu 9.04
-Steps taken-
1. capture MBR structure:
sudo sfdisk -d /dev/sda > sda_MBR.out
2. image the MBR:
sudo dd if=/dev/sda of=sda_MBR_446.img count=1 bs=446
3. span the images of the OSes:
sudo dd if=/dev/sda1 of=image_os_1a.img bs=1M count=4000
sudo dd if=/dev/sda1 of=image_os_1b.img bs=1M count=4000 skip=4000
...
sudo dd if=/dev/sda3 of=image_os_2a.img bs=1M count=4000
sudo dd if=/dev/sda3 of=image_os_2b.img bs=1M count=4000 skip=4000
...
4. restoring the MBR:
sudo sfdisk --no-reread -f /dev/sda < sda_MBR.out
5. re-imaging the MBR:
sudo dd if=sda_MBR_446.img of=/dev/sda count=1 bs=446
6. restoring the OSes && swap partition:
sudo mkswap /dev/sda2
sudo dd if=image_1a.img of=/dev/sda1 bs=1M conv=sync,noerror
sudo dd if=image_1b.img of=/dev/sda1 bs=1M conv=sync,noerror seek=4000
...
sudo dd if=image_2a.img of=/dev/sda3 bs=1M conv=sync,noerror
sudo dd if=image_2b.img of=/dev/sda3 bs=1M conv=sync,noerror seek=4000
...
Upon {warm|cold} reboot, we're dumped at GRUB, no going further.
We manually restore GRUB by:
sudo grub
find /boot/grub/stage1
root (hd0,$find)
setup (hd0)
quit
I've tried:
sudo grub-install (hd0)
sudo update-grub
at the command line but no success.
Your insight appreciated :)
Stu@
--
Then you will know the truth, and the truth will set you free
More information about the ubuntu-users
mailing list