小弟我的linux挂载分区

我的linux挂载分区

我的linux的挂载分区是root (hd0,5)

?

调整分区后修复grub引导小记

2008年7月7日 东莞SEO 发表评论 阅读评论

上次因为用pm修改ubuntu分区大小,然后导致grub不能引导。下面为我的解决方法
使用ubuntu 7.10 livecd启动,进入桌面系统,打开终端
在终端输入以下命令:
find /boot/grub/stage1 找到你的ubuntu分区位置,我的为hd0,9
1、Sudo grub 这里要求为超级用户的权限,所以要用sudo ,进入sudo后
2、root (hd0,x) x为你ubuntu分区位置,我的是hd0,9,如上面找到的
3、setup (hd0)
4、退出重启,成功修复引导。

下面为我在ubuntu中文社区所找到的资料:
hd0指第一块硬盘(不分串口SATA、并口PATA),
x是linux的主目录“/”所在分区号,编号从0开始,
root命令是指定引导的分区,
setup命令把引导信息写到硬盘MBR。

下面是来之ubuntu论坛的终极解释:作者:lisir 帖子地址:http://forum.ubuntu.org.cn/about65991.html
删除Linux与恢复grub,这是我等新手常遇到的两个问题,感觉Linux不好,想退出,就要删除Linux,覆盖Grub;而装了Windows与Linux双系统的用户,又会在重装Windows时把Grub覆盖掉,需要恢复Grub。这是后路,我们在做事之前需要先考虑好的。

删除Linux,覆盖Grub,还原成XP自带的启动引导,这个很简单,只要你有Windows XP盘(非Ghost),用它启动,至选择安装位置的地方退出重启就可以。或者用它启动故障修复台,运行fixboot或者fixmbr都可以。

而恢复Grub,其实也很简单的:用Live CD(对于Ubuntu来说就是Desktop CD或者DVD)启动,打开终端(Applications──>Accessory──>Terminal),执行以下代码: 代码:
sudo grub
find /boot/grub/stage1
root (hdX,Y)
setup (hdX)
quit

注意:其中的X、Y是执行find /boot/grub/stage1命令后系统提示的。,比如: 代码:
grub> find /boot/grub/menu.lst
(hd0,7)

注意:这里的grub>是执行sudo grub命令后进入grub环境得到的提示符,不用输入。这时,X就是0,Y就是7。

下面详细解释一下这几条命令:

sudo grub 以root用户身份启动grub,否则会出错,错误见后文
find /boot/grub/stage1 寻找/boot所在分区,其实换用find /boot/grub/menu.lst也一样。
这一步也可以跳过,在执行root (hdX,时连按两下Tab列出可用分区,自己确定是哪个分区。
如果是将/boot单独分区,详见说明。
root (hdX,Y) 设置硬盘hdX的根文件系统(root Device),实际就是设置/boot所在的分区
setup (hdX) 自动安装GRUB到硬盘hdX。
quit 退出GRUB
root、setup命令后都有空格,如果没有会出错误。
如果不以root用户身份会出现什么样的错误呢? 引用:
ubuntu@ubuntu:~$grub

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> find /boot/grub/stage1

Error 15: File not found

grub> find /boot/grub/menu.lst

Error 15: File not found

grub> root(hd0,7)

Error 27: Unrecognized command

grub> root (hd0,7)

Error 21: Selected disk does not exist
grub> setup (hd0)

Error 12: Invalid device requested

一个成功例子: 引用:
ubuntu@ubuntu:~$ sudo grub
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> find /boot/grub/menu.lst
(hd0,7)

grub> root (hd0,7)

grub> setup (hd0)
Checking if “/boot/grub/stage1″ exists… yes
Checking if “/boot/grub/stage2″ exists… yes
Checking if “/boot/grub/e2fs_stage1_5″ exists… yes
Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 15 sectors are embedded.
succeeded
Running “install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,7)/boot/grub/stage2 /boot/grub/menu.lst”… succeeded
Done.
grub>quit

这是最简单的方法,也有其它几个寻找/boot分区的方法,但稍麻烦点:
在终端使用ls /dev/sd*和ls /hd*命令来查找系统的外部设置,用sudo mkdir命令来建立挂载目录,用sudo mount命令挂载,再用ls命令查看是否/boot所在的分区。

也可以用sudo fdisk -l来找到启动分区(这里不涉及将/boot单独分区的情况,因为那种我没有实验过,不太清楚),如: 引用:
ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2295 18434556 7 HPFS/NTFS
/dev/sda2 2296 19456 137845732+ f W95 Ext’d (LBA)
/dev/sda5 2296 4845 20482843+ 7 HPFS/NTFS
/dev/sda6 4846 8669 30716248+ 7 HPFS/NTFS
/dev/sda7 8670 16557 63360328+ 7 HPFS/NTFS
/dev/sda8 * 16558 17361 6458098+ 83 Linux
/dev/sda9 17362 19393 16322008+ 83 Linux
/dev/sda10 1939

小弟我的linux挂载分区

相关文章:

你感兴趣的文章:

标签云: