Why are VG tags not visible from another node when using LVM on shared storage?
Environment
- Red Hat Enterprise Linux 7 - non-clustered environment
Issue
- Having a shared storage without cluster with LVM makes the VG tags created on one node not visible from the another node
Resolution
To force reading metadata from disk instead of cache use the '--cache' argument
for commands 'pvscan' or 'vgscan'.
pvscan --cache
vgscan --cache
Alternatively restart the LVM metadata caching service.
systemctl restart lvm2-lvmetad.service
Root Cause
The reason of not seeing metadata changes on another node is that by default
there is 'lvm2-lvmetad.service' service running.
This service is caching the LVM metadata which also includes the tags.
man 8 pvscan
When lvmetad is used, LVM commands avoid scanning disks by reading metadata from lvmetad.
When new disks appear, they must be scanned so their metadata can be cached in lvmetad. This
is done by the command pvscan --cache, which scans disks and passes the metadata to lvmetad.
The pvscan --cache command is typically run automatically by system services when a new device
appears. Users do not generally need to run this command if the system and lvmetad are run‐
ning properly.
Many scripts contain unnecessary pvscan (or vgscan) commands for historical reasons. To avoid
disrupting the system with extraneous disk scanning, an ordinary pvscan (without --cache) will
simply read metadata from lvmetad like other LVM commands. It does not do anything beyond
displaying the current state of the cache.
Diagnostic Steps
Having two nodes that are sharing common storage with LVM without clustering
- On node1 adding tag to VG
[root@node1]# vgchange --addtag newtag testvg
[root@node1]# vgs -o+vg_tags testvg
VG #PV #LV #SN Attr VSize VFree VG Tags
testvg 1 1 0 wz--n- 10.00g 6.00g newtag
- On node2 checking if tag exists
[root@node2]# vgs -o+vg_tags testvg
VG #PV #LV #SN Attr VSize VFree VG Tags
testvg 1 1 0 wz--n- 10.00g 6.00g
- running commands 'vgscan' and 'pvscan' doesn't help and tag is not visible on the node2
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.