fengxin215

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

采用LiveCD启动Ubuntu,之后就在Ubuntu下操作。

打开终端:
# 切换到root权限
ubuntu@ubuntu-laptop:~$ sudo -i
#找你ubuntu10.04所在分区
root@ubuntu-laptop:~# fdisk -l
看到的信息:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x191f4f73

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    27265023    13631488   27  Hidden NTFS WinRE
/dev/sda2   *    27265024    27469823      102400    7  HPFS/NTFS/exFAT
/dev/sda3        27469824   237185023   104857600    7  HPFS/NTFS/exFAT
/dev/sda4       237187070   976771071   369792001    5  Extended
Partition 4 does not start on physical sector boundary.
/dev/sda5       237187072   446902271   104857600    7  HPFS/NTFS/exFAT
/dev/sda6       446904320   806904319   180000000    7  HPFS/NTFS/exFAT
/dev/sda7       910905344   976771071    32932864   83  Linux
/dev/sda8       810905600   910899199    49996800   83  Linux
/dev/sda9       806905856   808904703      999424   82  Linux swap / Solaris
/dev/sda10      808906752   810897407      995328   83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 8472 MB, 8472494080 bytes
255 heads, 63 sectors/track, 1030 cylinders, total 16547840 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: 0x000a0d74

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb4   *         252    16547587     8273668    b  W95 FAT32

   2:把 /boot(linux启动的根目录)所在partition 先mount起來
   3:執行 sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444 /dev/sda
(0d104aff-ec8c-44c8-b811-92b993823444 就是有 /boot 那個硬碟的 UUID, /dev/sda ,只有一個硬碟的情況,一般都是sda,可以進Gparted 看看。)
在终端输入如下命令:

sudo update-grub

按照提示输入密码,如果顺利的话,会出现如下类似语句,那就表示成功了。

grub.cfg ...

Found Debian background: moreblue-orbit-grub.png

Found linux image: /boot/vmlinuz-2.6.31-15-generic

Found initrd image: /boot/initrd.img-2.6.31-15-generic

Found memtest86+ image: /boot/memtest86+.bin

Found Windows 7 (loader) on /dev/sda1

done
 
如果提示error: cannot find a device for / (is /dev mounted?). 重启PC,会进入grub,然后从硬盘启动linux,启动后再执行sudo update-grub
set root=(hd0,8)
linux /boot/vmlinuz-2.6.32-25-generic  root=/dev/sda8
initrd  /boot/initrd.img-2.6.32-25-generic
boot
posted on 2014-04-01 14:23  fengxin215  阅读(379)  评论(0)    收藏  举报