centos 7 failed to mount /sysroot -九游会国际娱乐

玩技e族 运维笔记评论739字数 1133阅读3分46秒阅读模式

一、问题说明:

机房一台系统的服务器异常故障重启后无法启动进入系统,提示 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

故障原因: 异常关机导致系统文件损坏,无法系统root分区;需要进行修复系统root分区。文章源自玩技e族-https://www.playezu.com/155650.html

二、解决方法:

1.进入救援模式

通过远程管理卡挂载一个新的centos7镜像,重启系统后进入救援模式操作;如果机器在本地的话可以用软碟通烧录个系统到u盘,之后bios启动选择u盘。文章源自玩技e族-https://www.playezu.com/155650.html

  • 选择 troubleshooting

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

  • 选择rescue a centos system

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

  • 加载成功后选择 3 直接跳转到shell命令行操作;
  • 如果远程管理卡挂载镜像进入救援一直卡着说明网络传输缓慢,需要去机房进行挂载

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

2. 查看系统分区卷组信息并激活

linux系统的/dev/mapper目录介绍文章源自玩技e族-https://www.playezu.com/155650.html

  • 查看当前卷的映射,可以发现有dm-0 和dm-1,缺少要修复的系统下的分区卷
  • ls -l /dev/mapper

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

  • 使用vgs命令查看逻辑卷组分区名为 volgroup00
  • 使用vgchang命令激活逻辑分区

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

  • 使用vgchang命令激活逻辑分区
#vgchang用途: 用于修改卷组的属性,经常被用来设置卷组是处于活动状态或非活动状态
#格式: vgchange -ay 卷组名
vgchange -ay volgroup00

再次查看当前卷的映射信息可以发现要修复的系统分区已激活文章源自玩技e族-https://www.playezu.com/155650.html

ls -l /dev/mapper

3. 进行修复系统root分区

  • 确认系统卷是否是xfs分区格式
  • lsblk -f
  • 执行 xfs_repari 系统xfs文件修复命令
  • xfs_repari -v -l /dev/mapper/volgroup00-lvroot
  • 将系统root分区卷lvroot挂载到一个目录下
  • mount /dev/mapper/volgroup00-lvroot /mnt
  • 进入到挂载目录下,查看挂载的root系统分区里面的fstab文件是否正确
  • cat /mnt/etc/fstab

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

如果在无法确认具体哪个卷坏了导致开机失败的话;文章源自玩技e族-https://www.playezu.com/155650.html

有必要的情况下,可以从第3步骤开始依次将每个卷都修复一下文章源自玩技e族-https://www.playezu.com/155650.html

4. 重启验证系统是否正常

  • 修复完成后进行重启,并将远程卡上挂载的新镜像卸载

5.如果没有逻辑分区的情况处理方式

blkid命令对查询设备上所采用文件系统类型进行查询。主要用来对系统的块设备(包括交换分区)所使用的文件系统类型、label、uuid等信息进行查询。文章源自玩技e族-https://www.playezu.com/155650.html

centos 7 failed to mount /sysroot文章源自玩技e族-https://www.playezu.com/155650.html

修复type=“xfs”类型的磁盘,执行以下命令,时间过长一定要耐心等待执行完毕文章源自玩技e族-https://www.playezu.com/155650.html

xfs_repair    /dev/sda1
xfs_repair    /dev/sda3

ps:百度上所有有关类型的文章都是一个copy一个没有任何营养,这个是本人亲身经历可以完美解决问题不是执行什么xfs_repair -v -l /dev/dm-0文章源自玩技e族-https://www.playezu.com/155650.html

注意:本文法律责任由该作者承担,侵权请联系▷诈骗举报◁▷新闻不符◁▷我要投稿◁
免责声明:本文内容来自用户上传并发布或网络新闻客户端自媒体,玩技博客仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请联系删除。

发表评论

匿名网友
确定