linux lvm损坏导致开机emergency mode修复

异常关闭linux电源容易导致启动失败进入emergency mode。


进入emergency mode的原因很多,通常是磁盘关机出现问题,可以通过用linux引导盘到rescue模式下查看原因并修复。

如果是lvm卷出现问题,可以用如下方式尝试修复:

1, lvm vgscan查看有哪些vg
# lvm vgscan
  Reading volume groups from cache.
  Found volume group "centos_master" using metadata type lvm2

2, 激活vg
# lvm vgchange -ay 
  2 logical volume(s) in volume group "centos_master" now active

3, 查看逻辑卷
# lvm lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos_master/swap
  LV Name                swap
  VG Name                centos_master
  LV UUID                XAhwdw-yLyi-JDXx-NwGF-QDJv-c06h-Jm7iYD
  LV Write Access        read/write
  LV Creation host, time master, 2018-12-05 23:49:56 +0800
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos_master/root
  LV Name                root
  VG Name                centos_master
  LV UUID                ozZUmD-fyQE-TakK-MQgH-6Dvt-4Tdj-783S70
  LV Write Access        read/write
  LV Creation host, time master, 2018-12-05 23:49:57 +0800
  LV Status              available
  # open                 1
  LV Size                <17.00 GiB
  Current LE             4351
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0


4,查看时哪个 lv挂载有问题,比如 mkdir /root/disk; mount /dev/centos_master/root /root/disk。 如果失败则mount会报错。
5,尝试修复有问题的逻辑卷
# fsck /dev/centos_master/root
fsck,来自 util-linux 2.23.2
If you wish to check the consistency of an XFS filesystem or
repair a damaged filesystem, see xfs_repair(8).

6, 按照向导用xfs_repair进行修复。通常是metatdata与卷journallog不一致,可以用如下方式尝试修复。
# xfs_repair -L  /dev/centos_master/root

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值