Couldnt find device with uuid – Recover LVM Metadata Linux

Couldnt find device with uuid – Recover LVM Metadata Linux

This is mostly because of a physical volume is accidentally removed, overwritten or destroyed. So LVM wont be able to find a original physical volume associated with a Volume Group with particular UUID, hence you get an below error when you use any lvm commands.

  Couldnt find device with uuid ‘FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk’.
Couldn’t find all physical volumes for volume group vgroot.

By writing a new metadata on the new physical volume by using the existing UUID, we can recover the LVM Metadata. From the above error, we have got the UUID “FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk”.

Couldnt find device with uuid - Recover LVM Metadata Linux

By default, the LVM label is placed in the second 512-byte sector. The LVM label identifies the device as an LVM physical volume which contains the UUID for the physical name. It also stores the size of block devices in bytes, and LVM metadata stored on the disk. An identical copy of the metadata is maintained in every metadata area in every physical volume within the volume group.

Lets get started.

Confirm the UUID of the physical volume from the corresponding VG (vgroot) file ( under the directory /etc/lvm/archive.

[[email protected] ~]# cat /etc/lvm/archive/* | grep -i “FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk”
id = “FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk”

Restoring UUID to recover the LVM Metadata

Use the –uuid and –restorefile arguments of the pvcreate command to restore the physical volume.

[[email protected] ~]# pvcreate –uuid “FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk” –restore /etc/lvm/backup/ /dev/sdd
Couldn’t find device with uuid FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk.
Writing physical volume data to disk “/dev/sdd”
Physical volume “/dev/sdd” successfully created

Use vgcfgrestore command to restore the volume group’s metadata.

[[email protected] ~]# vgcfgrestore vgroot
Restored volume group vgroot

Now your physical volume metadata is recovered.

Verify UUID

Use pvs command to ensure the UUID is replaced or not.

[[email protected]nitguide1 ~]# pvs -o pv_name,uuid
PV         PV UUID
/dev/sdd  FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk

If the volume is not active, then activate the volume. Else this step is not required.

[[email protected] ~]# lvchange -ay /dev/vgroot/lvroot

Hope you have got an idea how to restore or recover the LVM metadata using UUID.

Related Content on Linux might be useful to you to improve your Linux Skills.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.