====== Problem with LVM ======
===== A filesystem is automaticaly unmounted after 15 min ====
I got the problem, when moving an LV to a new VG (/var/log/messages)
Aug 19 16:53:44 xxxxxxx systemd: Removed slice User Slice of root.
Aug 19 16:57:03 xxxxxxx rsyslogd: -- MARK --
Aug 19 16:57:27 xxxxxxx systemd: Stopped target Local File Systems.
Aug 19 16:57:27 xxxxxxx systemd: Unmounting /ispd1/db/arclog...
Aug 19 16:57:28 xxxxxxx kernel: XFS (dm-25): Unmounting Filesystem
Aug 19 16:57:28 xxxxxxx systemd: Unmounted /ispd1/db/arclog.
Aug 19 16:57:28 xxxxxxx systemd: Stopped File System Check on /dev/mapper/vg_ispd1db-lv_ispd1arc.
Aug 19 17:00:01 xxxxxxx systemd: Created slice User Slice of root.
Aug 19 17:00:01 xxxxxxx systemd: Started Session 5395 of user root.
**solution:** systemd is not aware of the change of logical volume/volume group\\
Reload the systemd daemon
[root@xxxxxxx] ~ # systemctl daemon-reload
[root@xxxxxxx] ~ # systemctl status ispd1-db-arclog.mount
● ispnprd1-db-arclog.mount - /ispd1/db/arclog
Loaded: loaded (/etc/fstab; bad; vendor preset: disabled)
Active: active (mounted) since Wed 2020-08-19 17:33:21 CEST; 19h ago
Where: /ispd1/db/arclog
What: /dev/mapper/vg_ispd1arc-lv_ispd1arc
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
[root@xxxxxxx]) ~ # systemctl show ispd1-db-arclog.mount
Where=/ispd1/db/arclog
What=/dev/mapper/vg_ispd1arc-lv_ispd1arc
...
you can also check using
systemctl show dev-mapper-vg_ispd1arc.lv_ispd1arc.device
systemctl show dev-mapper-vg_ispd1arc
===== Recovering Physical Volume Metadata =====
Symptom:
[root@lnx001] ~ # pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_root lvm2 a-- <49.51g <25.26g
[unknown] vg_root lvm2 a-- <49.51g <25.26g
The VG is not active
You should not attempt this procedure with a working LVM logical volume. You will lose your data if you specify the incorrect UUID.
[root@lnx001] ~ # vgchange -an --partial
Partial mode. Incomplete volume groups will be activated read-only.
Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
Restore the PVID on disk partition
[root@lnx001] ~ # pvcreate --uuid "FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk" --restorefile /etc/lvm/archive/vg_root_00050.vg /dev/sda3
Physical volume "/dev/sda3" successfully created
Restore the VG
[root@lnx001] ~ # vgcfgrestore vg_root
Restored volume group vg_root
List the LVs
[root@lnx001] ~ # lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_home vg_root -wi------- 2.00g /dev/sda2(3712)
lv_opt vg_root -wi------- 512.00m /dev/sda3(1536)
lv_opt_tivoli vg_root -wi------- 2.00g /dev/sda3(1024)
Activate the LVs
[root@lnx001] ~ # lvchange -ay /dev/vg_root/lv_home
[root@lnx001] ~ # lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_home vg_root -wi-a----- 2.00g /dev/sda2(3712)
lv_opt vg_root -wi------- 512.00m /dev/sda3(1536)
lv_opt_tivoli vg_root -wi------- 2.00g /dev/sda3(1024)
===== Recovering Volume Group Metadata =====
Restore VG metadata
# vgcfgrestore VG
Restored volume group VG
Assign a random UUID to VG
# vgchange -an vg-name
# vgchange --uuid
# vgchange -an vg-name