[转]win7、ubuntu双系统,重装win7后,修复ubuntu启动项

在 win7和ubuntu双系统下,ubuntu使用光盘安装,当重装win7后,会覆盖ubuntu的grub启动项,这时可以通过ubuntu光盘来修 复grub启动项,重新进入前面的ubuntu系统,操作如下(均为我自己的系统信息:版本为ubuntu11.04):

1、用ubuntu14.04光盘启动后,进入“试用ubuntu”。

2、在终端中输入命令:sudo fdisk -l (为小写的L,查看系统中的分区信息),我的系统信息显示如下:

 

 

shangsongchao@ssc:~$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x1a03a918

   设备 启动      起点          终点     块数   Id  系统
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   105070591    52431872    7  HPFS/NTFS/exFAT
/dev/sda3       105070592   209926143    52427776    7  HPFS/NTFS/exFAT
/dev/sda4       209930238   976769023   383419393    f  W95 扩展 (LBA)
分区 4 未起始于物理扇区边界。
/dev/sda5       209930240   419645439   104857600    7  HPFS/NTFS/exFAT
/dev/sda6       419647488   524505087    52428800    7  HPFS/NTFS/exFAT
/dev/sda7       620974080   629360639     4193280   82  Linux 交换 / Solaris
/dev/sda8       629364736   976769023   173702144    7  HPFS/NTFS/exFAT
/dev/sda9       524507136   583239679    29366272   83  Linux
/dev/sda10      583241728   620959743    18859008   83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 8011 MB, 8011120640 bytes
255 heads, 63 sectors/track, 973 cylinders, total 15646720 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcad4ebea

   设备 启动      起点          终点     块数   Id  系统
/dev/sdb4   *         256    15646719     7823232    b  W95 FAT32

 

 

 

找出ID为83的一行(上面红色区域),记下ubuntu系统所在分区(我的为/dev/sda9).

   3、挂载目录

    mount /dev/sda9 /mnt

        4、输入

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

    (PS:/mnt后面有一个空格,root前面两根线 且有一个空格)

       重新安装grub2到硬盘的主引导记录MBR中,出现“Installation finished.No Error Reported.”表示操作成功。

        5、重启电脑,此时可以进入grub2引导界面了,注意,此时不能引导Windows 7,选择进入ubuntu系统,进入终端,输入命令:sudo update-grub2

若出现如下类似语句,则表示已经修复grub2成功:

 

shangsongchao@ssc:~$ sudo update-grub2
[sudo] password for shangsongchao: 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.18.6
Found initrd image: /boot/initrd.img-3.18.6
Found linux image: /boot/vmlinuz-3.18.6.old
Found initrd image: /boot/initrd.img-3.18.6
Found linux image: /boot/vmlinuz-3.13.0-40-generic
Found initrd image: /boot/initrd.img-3.13.0-40-generic
Found linux image: /boot/vmlinuz-3.11.0-26-generic
Found initrd image: /boot/initrd.img-3.11.0-26-generic
Found linux image: /boot/vmlinuz-3.2.0-34-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-34-generic-pae
Found linux image: /boot/vmlinuz-3.2.0-29-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-29-generic-pae
Found linux image: /boot/vmlinuz-2.6.32.66
Found initrd image: /boot/initrd.img-2.6.32.66
Found linux image: /boot/vmlinuz-2.6.32.66.old
Found initrd image: /boot/initrd.img-2.6.32.66
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done

 

转载自:http://827334325.blog.51cto.com/3841941/810014

http://blog.sina.com.cn/s/blog_6268defa0100t2d3.html

posted @ 2015-06-15 23:55  pingandezhufu  阅读(139)  评论(0)    收藏  举报