RHEL9 lvm更换主机后,重新识别lvm信息


前置环境为,存储映射到主机一个卷,主机新安装了个系统,安装完成后LVM信息识别不了

[root@io01 ~]# pvscan
  PV /dev/sda3   VG rhel   lvm2 [<1.82 TiB / 0    free]
  Total: 1 [<1.82 TiB] / in use: 1 [<1.82 TiB] / in no VG: 0 [0   ]
[root@io01 ~]# multipath -ll
mpatha (36d039ea0000573450000010f5e037df1) dm-3 LENOVO,DE_Series
size=19T features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 rdac' wp=rw
|-+- policy='service-time 0' prio=14 status=active
| |- 11:0:0:1 sdb 8:16  active ready running
| |- 11:0:1:1 sdd 8:48  active ready running
| |- 12:0:0:1 sdj 8:144 active ready running
| `- 12:0:1:1 sdl 8:176 active ready running
`-+- policy='service-time 0' prio=9 status=enabled
  |- 11:0:2:1 sdf 8:80  active ready running
  |- 11:0:3:1 sdh 8:112 active ready running
  |- 12:0:2:1 sdn 8:208 active ready running
  `- 12:0:4:1 sdp 8:240 active ready running

上面看到pvscan中没有存储过来的盘。

经过资料查看及咨询大佬,最终解决

[root@io01 ~]# pvscan --cache /dev/mapper/mpatha
  pvscan[3873] /dev/mapper/mpatha excluded: device is not in devices file.
[root@io01 ~]# cd /etc/lvm/devices/
[root@io01 devices]# ls
backup  system.devices
[root@io01 devices]# cat system.devices
# LVM uses devices listed in this file.
# Created by LVM command vgs pid 1776 at Sat Jan 25 11:55:18 2025
# HASH=1208368239
PRODUCT_UUID=61ab240c-564c-11e7-bd23-2c55d3b6069a
VERSION=1.1.5
IDTYPE=sys_wwid IDNAME=naa.6101b5442bcc7000259204982e836b6a DEVNAME=/dev/sda3 PVID=r7QCeOFAbhz7ie9O3cS2d3FQJ51c60fH PART=3
[root@io01 devices]# mv system.devices system.devices.bak
[root@io01 devices]# ls
backup  system.devices.bak
[root@io01 devices]# pvscan --cache /dev/mapper/mpatha
  pvscan[3885] PV /dev/mapper/mpatha online.
[root@io01 devices]# pvscan --cache --activate ay /dev/mapper/mpatha
  pvscan[3886] PV /dev/mapper/mpatha online, VG export_vg is complete.
  pvscan[3886] VG export_vg run autoactivation.
  1 logical volume(s) in volume group "export_vg" now active
[root@io01 devices]# lvs
  LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  export_lv export_vg -wi-a----- 18.69t
  home00    rhel      -wi-ao----  1.74t
  root00    rhel      -wi-ao---- 70.00g
  swap00    rhel      -wi-ao----  4.00g
[root@io01 devices]# mount /dev/mapper/
control              export_vg-export_lv  mpatha               mpathb               rhel-home00          rhel-root00          rhel-swap00
[root@io01 devices]# mount /dev/mapper/export_vg-export_lv /export/
[root@io01 devices]# cd /export/

最后还需要设置VG自动激活,要不重启后无法使用

[root@io01 ~]#  vgchange --autobackup y --available y export_vg
  1 logical volume(s) in volume group "export_vg" now active

文章作者: TerSup
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 TerSup !
  目录