I had to recover LVM metadata from one physical volume and here are the steps I followed. I am not sure why I got this situation, I’ve used LVM for a long time and this is the only one that I have to recover the metadata. The physical volume was backed by ISCSI lun.
Running pvdisplay command showed as no LVM volume:
$ sudo pvdisplay /dev/mapper/26a326a6471427270
No physical volume label read from /dev/mapper/26a326a6471427270
Failed to read physical volume "/dev/mapper/26a326a6471427270"
ISCSI session was OK:
$ sudo iscsiadm -m session
tcp: [25] 172.16.68.51:3260,1 iqn.2012-12:backups
tcp: [26] 172.16.68.151:3260,1 iqn.2012-12:backups
tcp: [27] 172.16.64.10:3260,1 iqn.2012-12:backups
tcp: [28] 172.16.66.10:3260,1 iqn.2012-12:backups
multipath detected the device paths OK:
26a326a6471427270 dm-11 SCST_BIO,j2jdqBrpZ2sYmXO3
size=13T features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=0 status=active
|- 30:0:0:0 sdaf 65:240 active ready running
|- 28:0:0:0 sdah 66:16 active ready running
|- 29:0:0:0 sdag 66:0 active ready running
`- 31:0:0:0 sdai 66:32 active ready running
$ sudo dmsetup ls --tree
vgsatar6_C02-ovznhshare05 (253:52)
└─26a326a6471427270 (253:11)
├─ (66:32)
├─ (66:0)
├─ (66:16)
└─ (65:240)
$ sudo ls -l /dev/vgsatar6_C02/ovznhshare05
lrwxrwxrwx 1 root root 8 ene 21 17:06 /dev/vgsatar6_C02/ovznhshare05 -> ../dm-52
Also the device was mounted and running fine:
$ mount
/dev/mapper/vgsatar6_C02-ovznhshare05 on /var/san/share05 type ext3 (rw,relatime,errors=continue,barrier=0,data=ordered)
But, I was sure that if the server was restarted the device was going to be lost and not mounted again.
The steps to recover the metadata were as follows:
umount the device:
$ sudo umount /var/san/share05
Open your last LVM backup for that VG in /etc/lvm/backup. In my case it was /etc/lvm/backup/vgsatar6_C02
Indentify the UUID for your physical volume in that file:
physical_volumes {
pv0 {
id = "1Babrx-VzKI-7Yav-9hGp-2KX2-DRgT-zdpAql"
device = "/dev/mapper/26a326a6471427270" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 27288010752 # 12,707 Terabytes
pe_start = 2048
pe_count = 3331055 # 12,707 Terabytes
}
}
In my case the Id was “1Babrx-VzKI-7Yav-9hGp-2KX2-DRgT-zdpAql”.
Recreate the physical volume again using the information saved in the backup:
$ sudo pvcreate --uuid "1Babrx-VzKI-7Yav-9hGp-2KX2-DRgT-zdpAql" --restorefile /etc/lvm/backup/vgsatar6_C02 /dev/mapper/26a326a6471427270
Restore volume group:
$sudo vgcfgrestore vgsatar6_C02
Activate logical volume and mount it again:
$ sudo lvchange -ay /dev/vgsatar6_C02/ovznhshare05
$ sudo mount /dev/vgsatar6_C02/ovznhshare05 /var/san/share05
And that’s all, I hope that will help someone.
For more info look at redhat documentation