Monday, January 28, 2008

recover GRUB

This procedure only can be applied for the case your system is under following condition.
1. Using a dual boot with other OS
2. Your boot loader was installed in MBR of hard disk.

If you installed windows OS on dual boot environment, you will not be boot into linux.
Windows was made for the case only one windows OS is installed in your computer.
Here goes the recovery procedure.

1. Boot with Ubuntu live CD.
2. in the gnome, check that your linux partition is shown in the Places - computer.
3. Open the terminal.
4. ubuntu@ubuntu:~$ mount
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw,mode=0755)
tmpfs on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw,mode=0755)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
/ dev/sda4 on /media/disk type ext3 (rw,nosuid,nodev)
/dev/sda1 on /media/vista type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096)
5. ubuntu@ubuntu:~$ sudo fdisk /dev/sda
Command (m for help): p

Device Boot Start End Blocks Id System
/dev/sda1 * 1 5624 45174748+ 7 HPFS/NTFS
/dev/sda2 5625 8046 19454715 7 HPFS/NTFS
/dev/sda3 8047 8173 1020127+ 82 Linux swap / Solaris
/dev/sda4 8174 9598 11446312+ 83 Linux

Command (m for help): q

6. ubuntu@ubuntu:~$ sudo grub
grub>root (hd0,3)

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)"... 17 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,3)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.
grub>quit

Tuesday, January 01, 2008