vgcfgbackup
Backup Volume Group configuration
TLDR
Back up metadata for all volume groups (to /etc/lvm/backup/ by default)
Back up metadata for a specific volume group
Write the backup to a specific file
Back up multiple VGs using a filename template (%s becomes the VG name)
Increase verbosity (repeat -v for more detail)
SYNOPSIS
vgcfgbackup [VolumeGroupName...]
DESCRIPTION
The vgcfgbackup command is an essential LVM (Logical Volume Manager) utility designed to create a backup of the metadata associated with one or more LVM volume groups. LVM metadata contains crucial information about the structure and configuration of logical volumes, volume groups, and physical volumes. This includes details like logical volume names, sizes, physical extents mapping, and RAID configurations (if applicable). While many LVM operations automatically trigger a metadata backup, vgcfgbackup allows for manual, explicit backups. These backups are typically stored in /etc/lvm/backup (for the most recent state) and /etc/lvm/archive (for historical states). A clean and up-to-date metadata backup is paramount for disaster recovery, enabling the restoration of the LVM configuration using vgcfgrestore in case of corruption or accidental deletion of the original metadata on disk. Without accurate metadata, LVM volumes can become inaccessible, leading to data loss. Therefore, understanding and utilizing vgcfgbackup is a critical part of LVM system administration for ensuring data integrity and recoverability.
CAVEATS
- This command backs up only the LVM metadata, not the actual user data stored within the logical volumes. Data backups must be handled separately.
- While vgcfgbackup can be run manually, most LVM commands (like lvcreate, lvremove, vgextend, etc.) usually perform automatic metadata backups before making changes.
- The default backup directories (/etc/lvm/backup and /etc/lvm/archive) should be regularly backed up as part of your system's overall backup strategy.
AUTOMATIC BACKUPS
Most LVM commands that modify LVM metadata (e.g., lvcreate, lvremove, vgextend) automatically trigger a metadata backup before applying changes. This provides an implicit safety net.
BACKUP LOCATIONS
LVM metadata backups are typically stored in two directories:
/etc/lvm/backup: Contains the most recent metadata backup for each volume group.
/etc/lvm/archive: Stores historical copies of metadata backups, with each change generating a new dated archive file. The number of archived backups is configurable in lvm.conf.
CONFIGURATION FILE
The behavior of LVM metadata backups (e.g., the number of archive copies to keep) can be configured in the /etc/lvm/lvm.conf file.
HISTORY
vgcfgbackup is a fundamental component of LVM2 (Logical Volume Manager version 2), which superseded LVM1 and became the standard LVM implementation in Linux kernels starting around 2002-2003. LVM2 introduced significant improvements in scalability, flexibility, and robustness compared to its predecessor. The ability to explicitly back up LVM metadata, like with vgcfgbackup, has been a core feature since LVM2's inception, recognizing the critical importance of configuration metadata for system recovery and stability. Its design reflects the best practices for managing complex storage configurations, ensuring that administrators have the tools to recover from various failure scenarios.
SEE ALSO
vgcfgrestore(8), lvm(8), vgchange(8), vgs(8), lvs(8)