LVM信息丢失问题

2024/08/21

故障现象

登录某台主机,准备通过lvm在上面挂一个新的文件系统。执行vgdisplay后,发现非rootvg的那个vg不见了。执行lvdisplay和pvdisplay也看不到相关的设备。

通过df -h 可以发现该vg下的lv都正常被挂载,而且可以正常读写,lsblk也能看到这些目录。

故障处理

尝试执行vgscan,无法找到被隐藏的这个vg。

执行lvm后,进入交互界面:

$lvm
lvm> help
  Available lvm commands:
  Use 'lvm help <command>' for more information

  config          Display and manipulate configuration information
  devtypes        Display recognised built-in block device types
  dumpconfig      Display and manipulate configuration information
  formats         List available metadata formats
  help            Display help for commands
  fullreport      Display full report
  lastlog         Display last command's log report
  lvchange        Change the attributes of logical volume(s)
  lvconvert       Change logical volume layout
  lvcreate        Create a logical volume
  ...

在命令行下执行vgck,然后再执行vgs,lvs或者lvdisplay,都能正常查看到故障vg。只要执行vgdisplay,这个vg就又会被隐藏。

执行yum install lvm2,升级了这个软件包,发现问题解决。

关联问题

redhat9以上的版本存在如下问题 Default use_devicesfile value results in non bootable system after upgrade to 9.2 or later - Red Hat Customer Portal

Environment

  • Red Hat Enterprise Linux 9
  • LVM2
    • use_devicesfile=1 in /etc/lvm/lvm.conf (default value in RHEL 9 is ‘1’:enabled)

Issue

  • The system fails to boot and drops to maintenance mode when the default use_devicefiles value is set and upgrading from Red Hat Enterprise Linux 9

Resolution

  • We have identified this issue as a bug and have filed a private Bugzilla ticket 2208342 for further action by our Engineering team.
  • If you are affected by this issue, we encourage you to open a support case to raise visibility on this bug.
  • The timeframe for Bugzilla support cases is different from typical support cases and are nominally outside of Service Level Agreement update times.
  • Either fix the contents, or disable use, of /etc/lvm/devices/system.devices
    • To disable the use of the LVM2 system.devices cache file, add use_devicesfile=0 in /etc/lvm/lvm.conf using rescue mode.
    • To fix the contents of system.devices:
        1. Remove any/all the problematic device lines in /etc/lvm/devices/system.devices file
        1. Add the devices back into the file
        1. Verify with LVM command
        1. Reboot the system
      • See Diagnostics for further details.

Raw


  # lvmdevices --delpvid xxxxxxxxxxxxxxxxxxxxxxxxxxxxeMWc         # 1. Remove bad entries by PVID (UUID)
    -or- 
  # lvmdevices --deldev sdb                                       # 1. Removed bad entries by DEVNAME
    -or-                                                          # 1. Remove the whole file
  # mv /etc/lvm/devices/system.devices /etc/lvm/devices/system.devices.$(date +%Y%m%d.%H%M%S)
                              
  # vgimportdevices -a                                            # 2. Add back in all missing devices    
    -or-               
  # lvmdevices --adddev /dev/sdb                                  # 2. Add back in individual devices
                                                             
  # pvs                                                           # 3. Verify system.devices issue(s) corrected

  # reboot                                                        # 4. Reboot the system

Diagnostic Steps

  1. Install Red Hat Enterprise Linux version 9.1
  2. Upgrade it to Red Hat Enterprise Linux version 9.2
  3. The system drops to maintenance mode
  4. The system devices file does not contain all PV’s.

Raw

# pvs   
Reloading config files  
Devices file sys_wwid <wwd> PVID <pv_uuid> last seen on /dev/N not found.   
Reloading config files

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.