In many cases, lvm configuration gets corrupted. So the best pratice to have the lvm configuration is to backup. lvm could also be corrupted on some disk failures and on reboot OS fails to boot up. So it is important to have the lvm configuration backup.
vgcfgbackup takes the configuration metadata from the lvm header of the disk and save to a default file location /etc/lvmconf/base_vg_name.conf. By default, vgcfgbackup runs automatically each time, the lvm command changes the lvm configuration.
The command has option -f and -u and it is explained below:
#vgcfgbackup [-f vg_conf_path ] [-u] vg_name
The path name of a volume group
Save the conﬁguration using an alternate ﬁle name speciﬁed by vg_conf_path. If -f is omitted, the default ﬁle name is in the form of /etc/lvmconf/base_vg_name.conf. Where base_vg_name is the base name of vg_name.
For example, if vg_name is speciﬁed as /dev/vg00, base_vg_name is vg00.
Update the conﬁguration backup ﬁle with the latest lvm conﬁguration. Only those physical volumes added since the conﬁguration backup ﬁle was last modiﬁed need to be online. If -u is omitted, all physical volumes for vg_name must be online.
The vgcfgrestore command restores LVM volume group conﬁguration from backup ﬁle or kernel memory. Restore cannot be performed if the volume group is activated in shared mode. The vgcfgrestore command restores the lvm conﬁguration data from a default (-n option) or alternate (-f option) conﬁguration backup ﬁle, or from kernel memory (-k option), to the physical volume named by pv_path. Examples are given below.
Restore the lvm conﬁguration information for the physical volume /dev/rdsk/c0t7d0 that was saved in the default ﬁle vg00.conf in the path /etc/lvmconf:
#vgcfgrestore -n /dev/vg00 /dev/rdsk/c0t7d0
Restore the lvm conﬁguration information to physical volume /dev/rdsk/c0t4d0 using alternate conﬁguration ﬁle /tmp/vg00.backup:
#vgcfgrestore -f /tmp/vg00.backup /dev/rdsk/c0t4d0