天天看点

Recover Grub after Windows 7 installation

安装windows 7 和 debian 7 双系统。装了一个另一个启动找不到。先装debian 7,然后装windows 7,debian的grub被覆盖。这里是我恢复的操作,可以成功,记录下来,以免下次遇到,又要找好半天。

1. 制作liveusb系统

到 http://www.pendrivelinux.com/tag/live-linux-usb-creator/ 或者 http://www.linuxliveusb.com/ 找一个下载,照着安装即可。

2. 在bios中设置为u盘启动。启动后进入debian live,以管理员身份打开一个terminal。首先要先更新源,安装grub-pc。

># apt-get update

># apt-get install grub-pc  

3. 使用fdisk -l来查看linux分区。假设debian根系统在/dev/sda6分区,/boot在/dev/sda2分区,挂载这两个分区。

># fdisk -l

># mount /dev/sda6 /mnt

># mount /dev/sda2 /mnt/boot

4. 安装grub

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

success if it shows "installation finished. no error reported.", otherwise, failed.

5. 将系统运行状态绑定在挂载的分区上。这一步非常重要,一定要绑定,不然grub更新不出东西。

># mount --bind /proc /mnt/proc

># mount --bind /dev /mnt/dev

># mount --bind /sys /mnt/sys

6. 更新grub

># chroot /mnt update-grub

7. 卸载系统运行状态

># umount /mnt/sys

># umount /mnt/dev

># umount /mnt/proc

8. ok,重装grub成功,重启系统。

># reboot

reference:

[1] http://blog.csdn.net/eric_jjc/article/details/5682210 这个少了绑定系统运行状态。

[2] http://www.ubuntugeek.com/how-to-restore-grub-boot-loader-after-installing-windows.html 这个少了安装grub-pc。

继续阅读