Context
I am running a Red Hat Enterprise Linux release 8.5 system in a VM on a VMWare ESXI.
I needed more space on a precise logical volume called lv_pmp
on that VM :
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 80G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 78,4G 0 part
├─VGslash-lv_root 253:0 0 19,5G 0 lvm /
├─VGslash-lv_swap 253:1 0 4G 0 lvm [SWAP]
├─VGslash-lv_usr 253:2 0 8G 0 lvm /usr
├─VGslash-lv_srv 253:3 0 2G 0 lvm /srv
├─VGslash-lv_home 253:4 0 2G 0 lvm /home
├─VGslash-lv_opt 253:5 0 4G 0 lvm /opt
├─VGslash-lv_tmp 253:6 0 4G 0 lvm /tmp
├─VGslash-lv_var_log_audit 253:7 0 512M 0 lvm /var/log/audit
├─VGslash-lv_var_log 253:8 0 1G 0 lvm /var/log
├─VGslash-lv_vartmp 253:9 0 10,4G 0 lvm /var/tmp
├─VGslash-lv_var 253:10 0 3G 0 lvm /var
└─VGslash-lv_pmp 253:11 0 20G 0 lvm /pmp
sr0 11:0 1 1024M 0 rom
So I resized the disk of the VM to 500G in the VSphere properties which appeared on the sda
part :
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 78,4G 0 part
├─VGslash-lv_root 253:0 0 19,5G 0 lvm /
├─VGslash-lv_swap 253:1 0 4G 0 lvm [SWAP]
├─VGslash-lv_usr 253:2 0 8G 0 lvm /usr
├─VGslash-lv_srv 253:3 0 2G 0 lvm /srv
├─VGslash-lv_home 253:4 0 2G 0 lvm /home
├─VGslash-lv_opt 253:5 0 4G 0 lvm /opt
├─VGslash-lv_tmp 253:6 0 4G 0 lvm /tmp
├─VGslash-lv_var_log_audit 253:7 0 512M 0 lvm /var/log/audit
├─VGslash-lv_var_log 253:8 0 1G 0 lvm /var/log
├─VGslash-lv_vartmp 253:9 0 10,4G 0 lvm /var/tmp
├─VGslash-lv_var 253:10 0 3G 0 lvm /var
└─VGslash-lv_pmp 253:11 0 20G 0 lvm /pmp
sr0 11:0 1 1024M 0 rom
Then I resized the sda3
physical volume to match the newly added disk space with
$ resizepart /dev/sda 3 1000000000
$ pvresize /dev/sda3
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 476,9G 0 part
├─VGslash-lv_root 253:0 0 19,5G 0 lvm /
├─VGslash-lv_swap 253:1 0 4G 0 lvm [SWAP]
├─VGslash-lv_usr 253:2 0 8G 0 lvm /usr
├─VGslash-lv_srv 253:3 0 2G 0 lvm /srv
├─VGslash-lv_home 253:4 0 2G 0 lvm /home
├─VGslash-lv_opt 253:5 0 4G 0 lvm /opt
├─VGslash-lv_tmp 253:6 0 4G 0 lvm /tmp
├─VGslash-lv_var_log_audit 253:7 0 512M 0 lvm /var/log/audit
├─VGslash-lv_var_log 253:8 0 1G 0 lvm /var/log
├─VGslash-lv_vartmp 253:9 0 10,4G 0 lvm /var/tmp
├─VGslash-lv_var 253:10 0 3G 0 lvm /var
└─VGslash-lv_pmp 253:11 0 20G 0 lvm /pmp
sr0 11:0 1 1024M 0 rom
I increased the lv_pmp
logical volume size :
$ lvextend /dev/mapper/VGslash-lv_pmp -l+100%FREE
And refreshed the file system to let it detect the new size :
$ xfs_growfs /dev/mapper/VGslash-lv_pmp
So far so good I got the size I expected on the lv_pmp
logical volume :
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 476,9G 0 part
├─VGslash-lv_root 253:0 0 19,5G 0 lvm /
├─VGslash-lv_swap 253:1 0 4G 0 lvm [SWAP]
├─VGslash-lv_usr 253:2 0 8G 0 lvm /usr
├─VGslash-lv_srv 253:3 0 2G 0 lvm /srv
├─VGslash-lv_home 253:4 0 2G 0 lvm /home
├─VGslash-lv_opt 253:5 0 4G 0 lvm /opt
├─VGslash-lv_tmp 253:6 0 4G 0 lvm /tmp
├─VGslash-lv_var_log_audit 253:7 0 512M 0 lvm /var/log/audit
├─VGslash-lv_var_log 253:8 0 1G 0 lvm /var/log
├─VGslash-lv_vartmp 253:9 0 10,4G 0 lvm /var/tmp
├─VGslash-lv_var 253:10 0 3G 0 lvm /var
└─VGslash-lv_pmp 253:11 0 418,4G 0 lvm /pmp
sr0 11:0 1 1024M 0 rom
Problem
The issue comes as soon as I reboot the system : it appears to lose the size changes I made to the sda3
physical volume, which in consequence prevents the lv_pmp
logical volume from being mounted (as it assumes it does not have enough space on the parent PV) :
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 76,9G 0 part
├─VGslash-lv_root 253:0 0 19,5G 0 lvm /
├─VGslash-lv_swap 253:1 0 4G 0 lvm [SWAP]
├─VGslash-lv_usr 253:2 0 8G 0 lvm /usr
├─VGslash-lv_srv 253:3 0 2G 0 lvm /srv
├─VGslash-lv_home 253:4 0 2G 0 lvm /home
├─VGslash-lv_opt 253:5 0 4G 0 lvm /opt
├─VGslash-lv_tmp 253:6 0 4G 0 lvm /tmp
├─VGslash-lv_var_log_audit 253:7 0 512M 0 lvm /var/log/audit
├─VGslash-lv_var_log 253:8 0 1G 0 lvm /var/log
├─VGslash-lv_vartmp 253:9 0 10,4G 0 lvm /var/tmp
└─VGslash-lv_var 253:10 0 3G 0 lvm /var
sr0 11:0 1 1024M 0 rom
Workaround
It is possible to get it back in shape by executing the following commands manually after the reboot :
### Re-apply physical volume changes
$ resizepart /dev/sda 3 1000000000
$ pvresize /dev/sda3
### Re-scan logical volumes
$ vgscan --mknodes -v
$ vgchange -a y
Question
Why is this happening ? And what can I do to prevent it ?
I do not know if this is related to the OS itself or to the VM environment or to some other factors I do not control, any advice on that regard would also help.
The workaround above is not really satisfying, even if I could place that in a script at startup, having to do this action every boot does not feel right: it does not make sense to me that a volume size change would not persist after a reboot.