双系统Windows和Ubuntu

我使用Windows 7和Ubuntu 14.04进行双启动。 我在启动菜单中都得到了但无法启动到Windows 7.现在配置Windows 7的主驱动器显示为包含所有文件的逻辑驱动器。 怎么解决?

这就是它所显示的:

irshad@irshad-desktop:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 58.6G 0 part /media/irshad/B2E08E69E08E339F ├─sda2 8:2 0 1K 0 part ├─sda5 8:5 0 195.3G 0 part /media/irshad/8E90A6A690A6946D ├─sda6 8:6 0 182.8G 0 part /media/irshad/7650B08250B04B1F ├─sda7 8:7 0 25G 0 part / └─sda8 8:8 0 4G 0 part sr0 11:0 1 1024M 0 rom 

我试图运行update-grub但我得到以下结果。

 $ sudo update-grub Generating grub configuration file ... /etc/grub.d/06_custom: 31: /etc/grub.d/06_custom: function: not found /etc/grub.d/06_custom: 34: /etc/grub.d/06_custom: save_env: not found /etc/grub.d/06_custom: 36: /etc/grub.d/06_custom: Syntax error: "}" unexpected 

最后我使用Testdisk启动了win 7。 如果有人在启动Windows时遇到问题,即使认为所有文件都存在/完整,也可以链接到解决方案。

如果您损坏了某个分区的引导扇区(例如,错误地将GRUB安装在其中),则可能会遇到麻烦。 例如,如果它是Windows分区,则无法再启动Windows。

备注:如果您遇到此问题, Boot-Repair应自动发出警告并告诉您损坏分区的名称(例如sda2)。

以下是如何修复它:

通过Ubuntu光盘

第1步 – 在liveCD或liveUSB上启动

在Ubuntu live-CD或live-USB上启动计算机,然后选择“Try Ubuntu”。

第2步 – 在实时会话中安装TestDisk

进入Ubuntu实时会话后,以这种方式安装TestDisk :

  1. 连接互联网
  2. 打开软件中心,在顶部栏中单击编辑 – >软件源 – >启用Universe存储库
  3. 打开终端( Ctrl + Alt + T )并键入:

     sudo apt-get update sudo apt-get install -y testdisk && sudo testdisk 

第3步 – 使用TestDisk

  1. 通过箭头和Enter键,转到[No log]菜单,
  2. 然后选择破碎分区所在的磁盘,
  3. 然后选择[继续],
  4. 然后选择分区类型(通常是[Intel]),
  5. 然后[高级],
  6. 然后使用[Boot]选择损坏的分区,它将显示如下内容:

     Boot sector Status: Bad Backup boot sector Status: OK Sectors are not identical. A valid NTFS Boot sector must be present in order to access any data; even if the partition is not bootable. [ List ] [Backup BS] [Rebuild BS] [ Dump ] 
  7. 检查“备份引导扇区”下面是否有“状态正常”

  8. 选择[备份BS]。

完成

通过Windows光盘

此方法只能修复Windows分区的引导扇区。

  1. 获取Windows恢复磁盘,如本页所述

  2. 启动它,并使用’fixboot’命令(而不是’fixmbr’命令)。 这应该修复Windows的bootsector。

来源:Ubuntu官方文档

使用Windows 7安装CD启动系统以首先修复Windows启动。

从第一个对话框中选择语言后,转到“修复系统”。
使用命令提示符(疑难解答►高级选项►命令提示符)
键入bootrec /fixboot然后按Enter键
键入bootrec /fixmbr然后按Enter键

然后从Ubuntu live CD / USB启动并执行以下步骤来恢复您的grub:

  1. 打开终端(使用Ctlr + Alt + T
  2. 通过以下命令挂载/dev/sda7 (这是你可以从安装了root /分区的lsblk获得的) lsblk运行)

     sudo mount /dev/sda7 /mnt for i in /sys /proc /run /dev;do sudo mount --bind "$i" "/mnt$i";done sudo chroot /mnt 
  3. 并运行以下命令将grub安装到主分区/dev/sda

     grub-install /dev/sda 
  4. 更新grub并退出并重新启动系统。

     update-grub exit sudo reboot