CentOS无法启动,启动分区无法找到,然后就报了个堆栈信息:

ACPI: wmi: Mapper loaded
dracut Warning: No root device "block: /dev/sda4" found
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.

dracut Warning: Signal caught!
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.

kernel Panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Tainted: G I-------2.6.32-358.el6.x86_64 #1
Call Trace:
[<ffffffff8150cfc8>]? panic+0xa7/0x16f
[<ffffffff81073ae2>]? do_exit0x25/0x870
[<ffffffff81182885>]? fput_+0x25/0x30
[<ffffffff81073b48>]? do_group_exit+0x58/0xd0
[<ffffffff81073bd7>]? sys_exit_group+0x17/0x20
[<ffffffff8100b072>]? system_call_fastpath+0x16/x1b
Panic occurred, switching back to text console
*note1*: block device sought is not shown in /dev/fstab.

看样子是磁盘找不到了,想想前不久加了个磁盘装了其他的系统,会不会是影响了分区。

然后进去到另外的ubuntu系统,查看分区表:

image.png

发现分区全部挂在了sdb,然而实际上最开始装系统的时候磁盘应该是sda:

image.png

分析了一下分区信息,其中 sdb1-sdb7 应该就是我的CentOS分区了,50G的sdb4就是根分区,先把它挂载到当前系统。

ma@Y485:~$ sudo mkdir /sdb4
ma@Y485:~$ sudo mount /dev/sdb4 /sdb4/
ma@Y485:~$ cat /sdb4/etc/fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda12 during installation
UUID=8c9c0656-bd8a-41e0-8aae-43eaf8938227 /               ext4    errors=remount-ro 0       1
UUID=6b60d3c1-221b-48de-9819-eb41cfbdc0cc /boot           ext4    defaults        0       2
UUID=BAE5-8056  /boot/efi       vfat    umask=0077      0       1
UUID=122bd403-dd15-4616-a5ee-95b3fbeba590 /data           ext4    defaults        0       2

发现所有的分区都是通过ID来标记的,因此基本定位到问题的原因为:添加新磁盘后,之前的磁盘变成了sdb分区,然而系统里面的磁盘ID还是指向开始的sda分区。就导致了分区找不到,系统无法启动。所以最后解决方法就是把所有的UUID都改成当前的分区号:

/dev/sdb4 /                       ext4    defaults        1 1
/dev/sdb2 /boot                   ext4    defaults        1 2
/dev/sdb1 /boot/efi               vfat    umask=0077,shortname=winnt 0 0
/dev/sdb6 /data                   ext4    defaults        1 2
/dev/sdb7 /home                   ext4    defaults        1 2
/dev/sdb5 /usr/local              ext4    defaults        1 2
/dev/sdb3 swap                    swap    defaults        0 0
...

保存重启,然后就好了。

最后修改:2019 年 04 月 07 日
喜欢就给我点赞吧