How do I restore my LVM configuration?

This article provides a guide for restoring a missing volume and the data on it when using LVM (Logical Volume Manager).

The problem

The LVM meta data of a Linux system is corrupted and the drives or partitions are not displayed when executing, PVdisplay, LVdisplay or VGdisplay.

EXAMPLE

so we will see here that it is on the twenty disk no partitions have been created yet , so lets first do this.

Create the design then Edison’s slabs sdb end for new mp4 partition number one and we create the same

Partitions of panchvi were created or not and then we will see that the acid is the powder of panchvi on it. Coriander has been Created.

Now we will convert it into physical volume. we can run the comment period slice bread .

Create VG (Volume Group)

To create a volume group, we will use vgcreate command. Creating VG means adding pv to the volume group.

Run following commands to verify the status of vg group
Create LV (Logical Volume)

Lvcreate command is used to create LV from the VG. Syntax of lvcreate command would look like below

In our case, following command will be used to create lv of size 9 GB

Run following commands to verify the status of LV group

Output above shows that LV (linux_lv) has been created successfully of size 9GiB.

Format LVM Partition

Use mkfs command to format the lvm partition. In our case lvm partition is /dev/linux_vg/linux_lv

Run following command to format LVM partition as ext4 file system.

Run following commands to verify the status of (ext4 file system )

To use above formatted partition, we must mount it on some folder. So, let’s create a folder /data
Now run mount command to mount it on /data folder,

Try to create some dummy file, run following commands,

Perfect, above commands output confirm that we can access lvm partition

Remove the newly created logical volume

Below command is not recommended to execute in Production Linux Server, be careful while executing these commands.

  • -umount /data
  • lvremove /dev/linux_vg/linux/lv

Now we have removed the newly created logical volume, at this moment the data’s in the volume has destroyed

Recover the Logical Volume by using vgcfgrestore command

Whenever logical volume group get modified the linux server will take the backup of existing configuration and save it in cd /etc/lvm/archive directory.

recover the deleted logical volume

Now it’s a time to mount the logical volume and see the existing data’s.

1 thought on “How do I restore my LVM configuration?”

Leave a Comment