admin管理员组

文章数量:1577825

异常关闭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

本文标签: lvmLinuxModeEmergency