移动硬盘安装BT5后如何添加启动项

作者:计算机教程

搞清楚是 Adobe 造的孽, 因此这个问题已经在 Launchpad 上面标记为危急级别 (https://bugs.launchpad.net/ubuntu/ source/grub2/ bug/730225)。

安装Windows 7后,需要通过光盘来修复比较方便,如果不用盘也可以在Win 7系统中,硬盘启动BT5镜像,来进行修复操作,具体步骤如下,从 BT5的ISO镜像文件启动之后,进入终端,先在终端输入命令:sudo fdisk -l (注意是小写的L,不是数字的1,此步用于确定电脑中安装BT5的所在分区的位置,输入以后会输出类似如下信息,找到ID为83的那行,记住 /dev/sdbX的情况,比如本人的电脑是/dev/sdb7,具体的自己更改)

如果你尚未安装 Ubuntu 11.04 Natty,现在请先缓一缓;如果已经是受害者了,请

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 / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x4b5f2a31

1.进入 Ubuntu,运行 sudo dpkg-reconfigure grub-pc 稍后会让你选择 Grub 的安装目标。在这里取消对/dev/sda 的选择,无视警告,改为选择 Ubuntu 安装的分区,这样做可以在 Ubuntu 没有修复这个问题之前,在 grub 软件包升级的 时候避免再一次破坏 NTFS 分区。

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3917    31463271    7  HPFS/NTFS
Partition 1 does not start on physical sector boundary.
/dev/sda2            3918       38913   281105370    f  W95 Ext'd (LBA)
Partition 2 does not start on physical sector boundary.
/dev/sda5            3918       16973   104872288    7  HPFS/NTFS
Partition 5 does not start on physical sector boundary.
/dev/sda6           16974       27418    83899431    7  HPFS/NTFS
Partition 6 does not start on physical sector boundary.
/dev/sda7           27419       38913    92333556    7  HPFS/NTFS
Partition 7 does not start on physical sector boundary.

2.找张 Win7 的安装盘,进入 PE 之后执行 chdksk c: /f 然后重启,再次进入 Ubuntu。

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0x2784c308

3.执行 sudo update-grub 这时候应该可以重新找到 Windows 的启动项,而且 Windows 应该能够正常进入了。

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        4462    35838976    7  HPFS/NTFS
/dev/sdb2            4463        7385    23478997    7  HPFS/NTFS
/dev/sdb3   *        7386       13593    49864704    7  HPFS/NTFS
/dev/sdb4           13594       19457    47102549    f  W95 Ext'd (LBA)
/dev/sdb5           13594       18166    36732591   83  Linux
/dev/sdb6           18167       18410     1959898   82  Linux swap / Solaris
/dev/sdb7           18411       19457     8409996   83  Linux

4.如果有必要,请使用 sudo dd if=/dev/sda of=/ubuntu.mbr bs=446 count=1 把 MBR 备份出来,复制到一个 Windows 认识的分区,然后到 Windows 下面添加启动项。这样 可以避免一旦重装 Windows 之后 Ubuntu 进不去的尴尬局面。

然后再输入sudo -i (此步用于得到root权限,无需输入密码,方便以下操作)
接着输入mkdir /media/tempdir (这里用于创建一个文件夹tempdir,用于挂载刚才的sdb7,此文件夹名称你可以依个人爱好而定,没有太多要求)

nba买球,Bug Description
Binary package hint: grub
The new grub-install of natty alpha3 now detects and avoids FlexNet-occupied sectors, but it seems it somehow mishandles something and writes code into after sector 63, thus make the ntfs partition that starts there unbootable and unreadable.
I have tested with a memory stick /dev/sdc partitioned like this:
ubuntu@ubuntu:~$ sudo fdisk -lu /dev/sdc
Disk /dev/sdc: 16.2 GB, 16236085248 bytes
255 heads, 63 sectors/track, 1973 cylinders, total 31711104 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00063979
   Device Boot Start End Blocks Id System
/dev/sdc1 63 25671869 12835903 7 HPFS/NTFS
/dev/sdc2 25671870 31696244 3012187 83 Linux
/dev/sdc1 was not mounted.
/dev/sdc2 was mounted on /mnt.
Then I downloaded FlexNet signature at http://forum.ubuntu.com.cn/viewtopic.php?f=49&t=320155&start=30
unzipped flexnet.sector32.zip, and wrote into sector32:
sudo dd if=flexnet.sector32 of=/dev/sdc seek=32
ran grub-install, it detected and avoided that sector:
ubuntu@ubuntu:~$ sudo grub-install /dev/sdc --root-directory=/mnt
/usr/sbin/grub-setup: warn: Sector 32 is already in use by FlexNet; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track.
Installation finished. No error reported.
NTFS partition /dev/sdc1 was now trashed. By design, the last sector of ntfs is a backup of its boot sector, so I copied the last sector of /dev/sdc1 to its first sector and successfully recovered the file system:
ubuntu@ubuntu:~$ sudo dd if=/dev/sdc of=/dev/sdc count=1 seek=63 skip=25671869
I took a further look at the sectors and found that the first sector of the partition was not the only sector that was overwritten by grub, and was surprised that by recoverying only the first sector the whole file system seemed good.
By removing the FlexNet signature, grub-install never overwrite the NTFS sectors again.
ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: grub (not installed)
ProcVersionSignature: Ubuntu 2.6.38-5.32-generic 2.6.38-rc6
Uname: Linux 2.6.38-5-generic i686
NonfreeKernelModules: wl
Architecture: i386
Date: Sun Mar 6 17:43:14 2011
LiveMediaBuild: Ubuntu 11.04 "Natty Narwhal" - Alpha i386 (20110302)
ProcEnviron:
 LANGUAGE=en_US:en
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: grub
UpgradeStatus: No upgrade log present (probably fresh install)

再输入 mount /dev/sdb7 /media/tempdir (将sdb7挂载于tempdir文件夹下)

nba买球 1

下面进入了本次恢复最为关键和激动人心的时刻,在终端输入以下命令:

本文由nba买球发布,转载请注明来源

关键词: