现在的位置: 首页 > 综合 > 正文

修复 grub

2018年02月20日 ⁄ 综合 ⁄ 共 1318字 ⁄ 字号 评论关闭

用ubuntu9.10以上(9.10以下的就是修复grub1(如不会,在我博客另一章里有介绍))的系统盘,启动光盘选择“试用而不安装”,进入后打开终端:

(注意命令间的空格,特别是mnt前面有空格)

补充/首先应该sudo fdisk -l   找到id=83的选项,如,我的是:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 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: 0xbbc20dd6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3891    31254426    7  HPFS/NTFS
/dev/sda2            3892        6261    19028992   83  Linux
/dev/sda3            6261       38914   262282241    f  W95 Ext'd (LBA)
/dev/sda4            6504       11727    41953280    7  HPFS/NTFS
/dev/sda5            6261        6504     1952768   82  Linux swap / Solaris
/dev/sda6           11727       24794   104960000    7  HPFS/NTFS
/dev/sda7           24794       38914   113414144    7  HPFS/NTFS
,这样获取自己ubuntu分区在/dev/sda2。

然后再按照以下去做

1. sudo -i

2. mount /dev/sda2 /mnt

3. mount /dev/sda2 /mnt/boot   这一步是有给 /boot 单独分区的命令,若没单独分区跳过这步

4. grub-install --root-directory=/mnt/ /dev/sda

5. 重启

6. 机子重启后就进了grub界面,但没进grub菜单,所以又有下面的步骤,在grub>提示符下输入:

7. find /boot/grub/core.img (若boot单独分区则:find /grub/core.ima)
此命令会得到个结果:(hdx,y)

8. root (hdx,y)

9. kernel /boot/grub/core.img
(boot单独分区则:kernel /grub/core.img)

10. boot
执行该命令后就转入到GRUB菜单,此时选择进入Ubuntu

11. 在ubuntu下启动终端

12. sudo grub-install /dev/sda
此命令用作修复grub,

经过上面的步骤就就能恢复到原来的双系统。

【上篇】
【下篇】

抱歉!评论已关闭.