libblockdev icon indicating copy to clipboard operation
libblockdev copied to clipboard

how to restore LVM configuration to a PV similar to vgcfgrestore

Open spictera opened this issue 5 years ago • 1 comments

Hi, In classic commercial HP-UX, one can restore the LVM metadata using vgcfgrestore /etc/lvm/backup/vg.cnf /dev/c0t0d0

Similar features exists in Linux version of LVM, but requires two steps. pvcreate -u <uid nr> /dev/sda vgcfgrestore <your vg> /etc/lvm/backup/vg.cnf

I am trying to find a way to use the libblockdev api to recreate the LVM metadata to a disk But could not find a way how to do this. I assume the bd_lvm_pvcreate() can be used in combination with an extra argument to create the PV using "-u", "" as described here: bd_extra_arg_new () But that is only the first step of the two, and is honestly useless as I only want to save the LVM metadata config to the PV.

Do you have any good idea of how this can be done? Or do you have any plans to create such features or vgcfgrestore feature ?

Looking forward to here your opinion of this.

Regards Tomas

spictera avatar Sep 16 '20 05:09 spictera

We currently don't support vgcfgrestore, but we can definitely add this to the LVM plugin. I've checked lvmdbusd which we use to interact with LVM and it also doesn't support the VG restore operation, but it can also be added, I did it in the past for some functions.

vojtechtrefny avatar Sep 18 '20 07:09 vojtechtrefny