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

Unix/Linux
linux查看内存的大小
在linux下写的代码,用的是utf-8,结果拿到XP下运行的时候,所有的中文都成乱码
linux su和sudo命令的区别
linux cron 下的定时执行工具使用技巧
linux 查找进程及终止进程操作的相关命令
redhat linux 安装 gcc编译器
Linux Mplayer播放各种格式的电影
一起回顾一下linux常用命令
Linux 网站项目发布要做哪些配置
linux SSH配合SecureCRT的密匙完美使用方法
GD 编译出错解决方法
Facebook Open Platform编译FAQ
Linux 系统硬盘 优化
linux 挂载详解
linux crontab定时命令
Linux 系统中确保访问三级域名畅通的方法
Linux 特权帐号VS普通帐号
确保Linux系统安全的前提条件 漏洞防护
Linux 监视系统资源使用率
Red Hat Linux上使用BIND建立DNS服务器

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


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