1、用安装Ubuntu的光盘启动live cd(如果原先是用u盘安装的同学,可以使用u盘启动盘代替live cd,效果一样,本人用的是thinkpad,在启动时按F12,选择从usb启动,按照默认进入linux系统)
显示结果类似如下信息: |
Disk /dev/sda: 500.1 GB, 500107862016 bytes#此处的/dev/sda代表电脑硬盘
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf0b1ebb0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3825 30724281 7 HPFS/NTFS
/dev/sda2 3826 60802 457661193 f W95 Ext'd (LBA)
Partition 2 does not end on cylinder boundary.
/dev/sda5 3826 11474 61440561 7 HPFS/NTFS
/dev/sda6 11475 26772 122881153+ 7 HPFS/NTFS
/dev/sda7 26773 42070 122881153+ 7 HPFS/NTFS
/dev/sda8 42071 54427 99257571 7 HPFS/NTFS
/dev/sda9 54428 54610 1464320 82 Linux swap / Solaris
/dev/sda10 54610 60802 49734656 83 Linux#此行为Linux分区,记下此Device名称
Disk /dev/sdb: 1977 MB, 1977614336 bytes#此处的/dev/sdb代表自启动U盘
61 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 3782 * 512 = 1936384 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00044e7e
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1021 1930680 c W95 FAT32 (LBA)
4、假如你的Ubuntu的/分区是sda7又假如/boot分区是sda6,在终端下输入如下命令 :
root@ubuntu:~# mount /dev/sda10 /mnt#将/dev/sda10代表的Linux分区挂载到/mnt目录下
root@ubuntu:~# mount /dev/sda6 /mnt/boot#将(如果没有/boot单独分区这不跳过)
root@ubuntu:~# grub-install --root-directory=/mnt/ /dev/sda#安装grub,如果正常的话会显示如下信息。
(注意是/mnt/(此处有空格)/dev/sda)
Installation finished. No error reported.
5.重启
root@ubuntu:~# reboot#重启电脑,你将会看到熟悉的grub启动界面!