Often time the Master Boot Record (MBR) is also lost / corrupted when the we’re having problem with the partition table, and so here I extend my previous post on recovering lost partition table using the Ubuntu Live CD.
First of all, let’s mount the related stuff;
ubuntu@ubuntu:~$ sudo mount -o ro /dev/sda1 /media/ ubuntu@ubuntu:~$ sudo mount -o bind /dev/ /media/dev/ ubuntu@ubuntu:~$ sudo mount -o bind /proc/ /media/proc/
and then chroot
ubuntu@ubuntu:~$ sudo chroot /media/
Once we are in the chroot environment, run grub
bash:~# grub
Assuming you are installing grub on your first harddisk, and your root filesystem in the first partition of your first harddisk, your journey should be something like this;
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2
/boot/grub/grub.conf"... succeeded
Done.
grub> quit
Once you’re done with that, you might want to unmount whatever you have mounted before. Don’t forget to exit from the mount directory first;
ubuntu@ubuntu:~$ cd .. ubuntu@ubuntu:~$ sudo umount /media/proc/ ubuntu@ubuntu:~$ sudo umount /media/dev/ ubuntu@ubuntu:~$ sudo umount /media
and then reboot to see if your problem is really fixed..









Your post just saved my a$$. Thanks!
01.28.08 at 8:43 am
Thanks! Fixed the mess WinXP made with my system.
09.11.08 at 10:08 am
Thanks man, this really helped, one thing is you don’t specifically say to exit out of the chroot before you do the umount but i got it anyway
10.26.08 at 12:01 am
Chris:
Thanks, I’ve updated the post.
11.03.08 at 2:52 pm
Hi,
you made my day!
Thank you.
My problem occurs when I tried to upgrade from grub to grub2 on ubuntu jaunty alpha4.
Best regards
Thorsten
02.23.09 at 2:31 pm