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

Recover Grub after Windows 7 installation

2019年03月29日 ⁄ 综合 ⁄ 共 1003字 ⁄ 字号 评论关闭

安装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。

抱歉!评论已关闭.