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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. ufw: command not found
  2. Mutt, Mail and Telnet – Send mails from linux command line or terminal
  3. CentOS / RHEL 7 : How to configure kdump using GUI
  4. How to change the number of commands stored in Bash History
  5. How to Audit for Modifications to files and Executions of Files in Linux
  6. sic Command Examples in Linux
  7. ltrace Command Examples in Linux
  8. mtr: command not found
  9. repo-add Command Examples in Linux
  10. How to Configure Existing Lvm Volume Group to Use DM-Multipath

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright