2010年5月6日 星期四

Installing grub in ubuntu

When you just finished you ubuntu installation proccess,
you might forget grub.
Now you could install it by following steps:

root@sean-ubuntu:/boot/grub# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2d73085e

Device Boot Start End Blocks Id System
/dev/sda1 1 243 1951866 82 Linux swap / Solaris
/dev/sda2 5905 9728 30716280 f W95 Ext'd (LBA)
/dev/sda3 * 244 5904 45471982+ 83 Linux
/dev/sda5 5905 9728 30716248+ 7 HPFS/NTFS

Partition table entries are not in disk order
root@sean-ubuntu:/boot/grub# grub-install /dev/sda3
Searching for GRUB installation directory ... found: /boot/grub
Installing GRUB to /dev/sda3 as (hd0,2)...
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/sda

root@sean-ubuntu:/boot/grub# update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
Searching for splash image ... none found, skipping ...
Found GRUB 2: /boot/grub/core.img
Found kernel: /boot/memtest86+.bin
Found kernel: /boot/vmlinuz-2.6.31-14-generic
Found GRUB 2: /boot/grub/core.img
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done
root@sean-ubuntu:/boot/grub# vi menu.lst


Now , we should considerate about 2nd Operation System(like Windows XP).
root@sean-ubuntu:/boot/grub# vi menu.lst
#insert to the end of menu.lst
title windows partition
rootnoverify (hd0,4)
chainloader +1
makeactive


Finially, you should to make MBR available for the Grub multi-boot function.
in linux(ubuntu)
#grub
grub> find /boot/grub/stage1
(hd0,2)
grub> root (hd0,2)
grub> setup(hd0)
grub> quit
and the reboot the linux, you will see a grub menu( /boot/grub/menu.lst)

PS.
1.if you want to make Windows and Ubuntu in the same PC
see: wubi for windows
or
install ubuntu in windows by wubi
2.grub reference: Grub basic

沒有留言:

張貼留言

文章分類