This post will show you how to recover LVM physical volume metadata in linux when you get an error something like "Couldnt find device with uuid".
If you are interested in learning, Request you to go through the below recommended tutorial.
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
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".
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 (VolumeGroupName_xxxx.vg) under the directory /etc/lvm/archive.
[root@learnitguide1 ~]# 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.[root@learnitguide1 ~]# pvcreate --uuid "FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk" --restore /etc/lvm/backup/vgroot_xxxx.vg /dev/sddUse vgcfgrestore command to restore the volume group's metadata.
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
[root@learnitguide1 ~]# 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.[root@learnitguide1 ~]# 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.
[root@learnitguide1 ~]# 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.
How to Configure IP Address on Ubuntu using Netplan
How to Access Linux Server from Windows Remotely
Configure SSH Passwordless Login Authentication (SSH-keygen)
How to Create LVM Partition in Linux – LVM Tutorial
Install & Configure Samba Server on Linux (RHEL7 / CentOS7)
How to Access Linux Server from Windows Remotely
Configure SSH Passwordless Login Authentication (SSH-keygen)
How to Create LVM Partition in Linux – LVM Tutorial
Install & Configure Samba Server on Linux (RHEL7 / CentOS7)
Keep practicing and have fun. Leave your comments if any.
Stay connected with us on social networking sites, Thank you.
0 Comments