• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL LVM : Backing Up Volume Group Metadata

by admin

– LVM metadata contains configuration details of volume groups.
– Metadata backups and archives are automatically created on every volume group and logical volume configuration change.
– Backups are stored in /etc/lvm/backup.
– Archives are stored in /etc/lvm/archive.
– Configuration settings are stored in /etc/lvm/lvm.conf.
– You can also use lvm dumpconfig command to display configuration settings.

# lvm dumpconfig
config {
	checks=1
	abort_on_errors=0
	profile_dir="/etc/lvm/profile"
}
.....
backup {
	backup=1
	backup_dir="/etc/lvm/backup"
	archive=1
	archive_dir="/etc/lvm/archive"
	retain_min=10
	retain_days=30
}
....

If you check the backup directory, you would already find a backup of all the VGs (in my case centos VG).

# ls /etc/lvm/backup
centos

The file centos would contain all the information required to rebuild the VG. For example PVs, LVs and all the other attributes.

# cat centos
...
description = "Created *after* executing 'lvextend -L 500m centos/mythinpool'"
...
myvolg {
...
physical_volumes {
        pv0 {
...
				device = "/dev/sda2" 
...

logical_volumes {
        mythinvol {
...

Note that the description states the backup file was created “after” executing the lvcreate command.

Similarly, you would find archives in the directory /etc/lvm/archive.

# ls /etc/lvm/archive
centos_00000-1969725188.vg  centos_00001-514510045.vg ....
# cat centos_00001-514510045.vg
...
description = "Created *before* executing 'vgextend centos /dev/sdb'"
...
myvolg {
...
			physical_volumes {
        pv0 {
...
					device = "/dev/sda2" 
...

Creating metadata backup

You can manually back up the metadata by using the vgcfgbackup command. For example, the following command backs up the metadata of the centos volume group to the /etc/lvm/backup/centos file:

# vgcfgbackup centos
  Volume group "centos" successfully backed up.

You can also include the –f file_today argument to the vgcfgbackup command to backup the metadata to a different location.

# vgcfgbackup -f /var/tmp/centos_metadata.bkp centos
  Volume group "centos" successfully backed up.

You can use the diff command to compare the differences between two metadata backups taken.

Filed Under: Linux

Some more articles you might also be interested in …

  1. cpuid Command Examples in Linux
  2. nsnake: command not found
  3. What is the purpose of .bash_profile file under User Home Directory In Linux
  4. How to enable IPv6 on CentOS / RHEL 6
  5. Configuring Persistent Storage in CentOS/RHEL 5,6 for Single Path using udev rules
  6. How to Disable the ‘lvm2-lvmetad.socket/service’ on CentOS/RHEL 7
  7. Connection using SSH to a Host Not in DNS/hosts Stalls for Some Time at Connection Initiation
  8. Basic “ls” Command examples in Linux
  9. burpsuit Command Examples in Linux
  10. Glusterfs – Advanced Troubleshooting Tips and Tricks

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright