当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > 更改分区后,linux无法启动,恢复小记

Unix/Linux
RHEL 5服务器系统下故障处理方法
Linux系统下图形界面更改IP地址
Linux操作系统下禁止单用户模式登录的操作方法
Linux中QQ软件的安装和配置
linux 操作系统 uniq命令的说明和使用
Linux 上如何使用QQ和MSN工具
The file /boot/grub/stage1 not read cor 解决办法
如何修改apache 2最大连接数
4G内存时linux的mtrr表不正确的解决
制作Linux的U盘(usb)启动盘
Linux Telnet登录慢问题解决
LINUX操作系统死机解决办法
linux的3种引导方法
vi编辑器使用技巧
Linux使用的一些基本问题
Linux系统下使用wine运行迅雷5的方法
startx启动图形界面失败的几个解决方法
Red Hat Enterprise Linux AS4( 企业版4.0下载)
Raid的学习和基础知识
Linux 下如何配置 PHP 支援 GD

Unix/Linux 中的 更改分区后,linux无法启动,恢复小记


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 89 ::
收藏到网摘: n/a

今天整理硬盘,把整个D盘(hda5)腾了出来,终于有空间试验raid+lvm+reiserfs v4.0啦立刻用PQ删除了分区,成了未分配空间。正如预料的,由于分区改动了,linux进不去了。于是开始了一番恢复。。。。。。
Ok,Let`s go ! 先来看看分区情况吧! 未删除分区情况:/dev/md0  <---------------> RAID设备 (lfs-6.0优化根分区)/dev/hda1 <---------------> C盘 (主分区)/dev/hda2 <---------------> 扩展分区/dev/hda3 <---------------> 主分区,未分配/dev/hda4 <---------------> 主分区,未分配/dev/hda5 <---------------> D盘  (逻辑分区) /dev/hda6 <---------------> E盘  (逻辑分区)/dev/hda7 <---------------> lfs-6.0根分区(未优化)/dev/hda8 <---------------> /boot分区(全局)/dev/hda9 <---------------> 线性RAID使用的分区(0)/dev/hda10<---------------> Mandrake根分区/dev/hda11<---------------> SWAP交换分区/dev/hda12<---------------> 线性RAID使用的分区(1)删除后分区情况:/dev/md0  <---------------> RAID设备 (lfs-6.0优化根分区)/dev/hda1 <---------------> C盘 (主分区)/dev/hda2 <---------------> 扩展分区/dev/hda3 <---------------> 主分区,未分配/dev/hda4 <---------------> 主分区,未分配/dev/hda5 <---------------> E盘  (逻辑分区)/dev/hda6 <---------------> lfs-6.0根分区(未优化)/dev/hda7 <---------------> /boot分区(全局)/dev/hda8 <---------------> 线性RAID使用的分区(0)/dev/hda9<---------------> Mandrake根分区/dev/hda10<---------------> SWAP交换分区/dev/hda11<---------------> 线性RAID使用的分区(1)很明显,更改后的分区号=原分区号-1 (删除的D盘) 进入grub命令行:grub> root (hd0,6)Filesystem type is ext2fs, partition type 0x83grub> kernel (hd0,6)/vmlinuz-lfs-6.0 root=/dev/hda6 vga=791 因为我的vmlinuz-lfs-6.0(lfs内核)是放在/boot分区(hda7)的而grub中(hd0,0)表示第一块硬盘的第一个分区(/dev/hda1)所以(hd0,6)就对应了/dev/hda7,(/boot分区)而lfs-6.0根分区修改后是/dev/hda6  所以是root=/dev/hda6 当我得意的按下enter时,意外发生了:Error 15: File not found咦?怎么会找不到文件呢?莫非我的分析完全错误了?接着我输入了:grub> find / 按下TAB键,让grub列出(hd0,6)/下面的东东:Possible files are: lost+found bin boot dev etc home lib .viminfomnt opt proc root sbin sys include tmp usr vargrub>真是奇怪,怎么(hd0,6)会是我的lfs根分区呢?它应该是/boot呀。查看下当前的分区情况吧:grub> root (hd0, 按下TAB键显示当前分区: Possible partitions are:   Partition num: 0,  Filesystem type is fat, partition type 0xb   Partition num: 5,  Filesystem type unknown, partition type 0x7   Partition num: 6,  Filesystem type is ext2fs, partition type 0x83   Partition num: 7,  Filesystem type is ext2fs, partition type 0x83   Partition num: 8,  Filesystem type is reiserfs, partition type 0xfd   Partition num: 9,  Filesystem type is ext2fs, partition type 0x83   Partition num: 10,  Filesystem type unknown, partition type 0x82   Partition num: 11,  Filesystem type unknown, partition type 0xfdgrub>将分区号+1,竟然仍然是修改前的分区号,只是少了(hd0,4)=/dev/hda5 真是#%^&grub> find (hd0,7)/ 再次按下TAB键,显示/dev/hda8的内容:grub vmlinuz us.klt System.map-2.6.8.1-12mdk config-2.6.8.1-12mdk vmlinuz-2.6.8.1-12mdk diag1.img diag2.img message-graphicinitrd-2.6.8.1-12  vmlinuz-lfs-6.0 .................grub>果然!/dev/hda8仍然是/boot分区,/dev/hda7是我的lfs根分区既然这样,那么原来的引导信息就应该可以正常引导了。grub > kernel (hd0,7)/vmlinuz-lfs-6.0 root=/dev/hda7 vga=791 结果可想而知,还是不能正常引导。(当然喽,能引导的话,就没意义记下了 ^_^)引导过程中,出现"no init found    root=.........."看来是没有找到根分区,真是奇怪,(hd0,6)下的确是我的lfs根分区阿!?莫非grub中标识的分区号和linux中的分区号标识不相同?? 试试先:grub > kernel (hd0,7)/vmlinuz-lfs-6.0 root=/dev/hda6 vga=791 grub > boot 根据grub中标识的分区号,vmlinuz-lfs-6.0在(hd0,7)下根据上面的分析,lfs-6.0的根分区是在/dev/hda6下 顺利进入!看来果真如此。grub仍然使用原始分区号,而linux中则是修改后的分区号[root@NEWLFS ~]#cfdisk  Name       Flags      Part Type  FSType          [Label]