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

Unix/Linux
小型机cpu类型
bind9的安装
如何查看服务器上有多少个CPU
wu-ftp 设置匿名服务器(转载)
Solaris硬盘分区学习笔记(转载)
如何在solaris中添加删除磁盘和分区 (转载)
共享光驱怎么做?
改solaris 8的ip地址的问题
加路径的问题 ;(
超级终端如何发送STOP+A?
如何对某个端口限制IP访问 比如 针对1521端口 只允许某个IP访问
如何让root用户远程telnet?
/usr/lib/ld.so.1损坏或丢失
[分享]Sun X3151A 光纤网卡故障排除实例
[分享]Solaris 2.6+Ultra5内置扬声器故障诊断实例
在VMWARE上装Sun Cluster 3.1 Update 3(ZT )
Windows客户端使用UNIX打印服务器上共享打印机的方法
如何改网卡IP地址
[color=darkblue]CacheFS笔记[/color]
在SUN工作站上安装RTL8139网卡

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 156 ::
收藏到网摘: 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]