Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1115429
  • 博文数量: 309
  • 博客积分: 6093
  • 博客等级: 准将
  • 技术积分: 3038
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-03 17:14
个人简介

linux学习记录

文章分类

全部博文(309)

文章存档

2014年(2)

2012年(37)

2011年(41)

2010年(87)

2009年(54)

2008年(88)

分类: LINUX

2008-12-31 16:54:01

linux系统出现grub loading stage2 解决办法

放入第一张光盘,重新启动机器,在boot: linux rescue
进去后执行出现Shell执行

#chroot    /mnt/sysimage

#/sbin/ grub-install /dev/hda(或者sda)

#exit

自己就重启了。OK.


如果执行grub-install的,你会得到如下报错:'/dev/hdx does not have any corresponding BIOS drive'.
解决方法:
请注意在执行下述命令之前,确保你的关键数据有一个有效的当前备份,不管什么原因导致你的第一快硬盘无法引导,你就需要使用Red Hat Enterprise Linux 的第一张安装光盘引导系统进入RESCUE模式。
要想在RESCUE模式下运行grub-install命令, 首先需要手动的mount相关的分区。可以通过fdisk -l 查看当前系统的分区:
# fdisk -l
     
你需要手动的mount所有类型是Linux和Linux RAID autodetect的分区,在如下的例子中,/boot分区是/dev/hda1, /分区是/dev/hda2。
   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1        13    104391   fd  Linux raid autodetect
/dev/hda2            14      1288  10241437+  fd  Linux raid autodetect
/dev/hda3          1289      1352    514080   82  Linux swap
     
在如下的样例中,你可以通过如下命令挂载分区:
# mkdir /mnt/sysimage
# mount /dev/hda2 /mnt/sysimage
# mount /dev/hda1 /mnt/sysimage/boot
# chroot /mnt/sysimage
     
下一个步骤是编辑文件/etc/grub.conf(或者是/boot/grub/grub.conf),按照下述描述取消文件中的一些注释。
修改
#boot=/dev/hda
成为
boot=/dev/hda
     
重新运行命令grub去安装GRUB到第二个硬盘的MBR上,从而使第二个硬盘可以引导。
# grub --batch --device-map=/boot/grub/device.map
   --config-file=/boot/grub/grub.conf --no-floppy
     
在grub命令的提示下,执行如下命令
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
     
setup命令会把Grub写入到MBR。使得第二块硬盘可以引导。
----------------------
请大家注意以下信息。(troubleshooting了一晚上,就学到了这点体会)
附:
cat /boot/grub/device.map
(fd0)   /dev/fd0
(hd0)   /dev/cciss/c0d0



阅读(1177) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~