Restoring GRUB

Marvin Stodolsky marvin.stodolsky at gmail.com
Sat Oct 10 00:48:09 UTC 2009


When you already know the Linux partition, these manual instructions
http://www.gnu.org/software/grub/manual/grub.html#Installing-GRUB-natively
suffice to recover boot of your Linux partition.

Basically boot with any Rescue Disk , such as the Ubuntu install CD in Test Mode
In your case  /dev/sda3 == Ext3/Ubuntu 9.04  == (hd0,2)
Open a console and the manual steps are
$ sudo su root
# grub
 grub> root (hd0,2)
 grub> setup (hd0)
then writes the location of hd0,2 to the MBR.
grub>
When you do a reboot, the /boot/grub/menu.lst  of the Ubuntu partition
wwill come up.

This I have done a few times, after a damned WinXP  re-install

MarvS



With that achieved, it is much easier to tune the /boot/grub/menu.lst
to boot other desired partitions.


On Fri, Oct 9, 2009 at 7:30 AM, Stuart Murray-Smith <eight32 at gmail.com> wrote:
> 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
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>




More information about the ubuntu-users mailing list