How to Backup and Restore the VxVM DiskGroup Configuration
It is always better to take a backup of VxVM critical data and never use it, than to never take a backup and one day need it. Using
vxconfigrestore we can make sure we are always ready for those little glitches.
vxconfigbackupd daemon automatically backs up VxVM DiskGroup configuration to the default backup directory whenever the configuration is changed.
vxconfigbackup command is provided to back up the configuration manually at any other desired time.
If there is ever a situation where the VxVM config files get corrupted and the disk group is not able to be imported, then we restore them from a vxconfigbackup.
vxconfigurestore is the utility for such occasion and comes with different options allowing us to choose which corrupted things are needed to be restored and what else can be ommitted.
Manually backup DiskGroup Configuration
We can use the
vxconfigbackup command to back up VxVM disk group configuration manually at any time.
vxconfigbackup [-l directory] [[dgname ...] | [dgid ...]]
- -l — specifies a directory other than the default where the backup configuration files are to be written.
- dgname/dgid (optional) — The disk groups to be backed up which you can specify either by name or by ID. If no disk groups are specified, all disk group configurations are backed up.
- The default location for backups is
- The binaries
vxconfigrestoreare located in
- Default location of backup file for disk group information is
- Default location of backup file for disk attributes is
- Default location of backup file for binary configuration copy is
- Default location of backup file for configuration records in
vxprint -mformat is
- To take a config backup of all DGs and save in the default location:
- To take a config backup of a particular disk group sand save it in the default location:
# vxconfigbackup <dgname/dgid>
- To take a config backup of all DGs and save in an alternate location:
# vxconfigbackup -l <directory>
- To take a config backup of a particular disk group and save it in an alternate location:
# vxconfigbackup -l <directory> <dgname/dgid>
Restoring DiskGroup Configuration
A restore of disk group configuration has two stages: precommit and commit. The precommit stage allows you to temporarily load the configuration that is to be restored, and examine it using the vxprint utility. At this stage, the disk group configuration is read-only. No permanent changes are written to disk until you choose to commit them. If desired, you can abandon the restore operation at the precommit stage.
vxconfigrestore comes with different options which aids in choosing which corrupt things that need to be restored which ignoring other information.
vxconfigrestore [ -c | -d | -n | -p ] [ -l directory ] [dgname | dgid]
- -c — (Commit) To commit changes to the disks permanently.
- -d — (Decommit) At precommit stage we can abandon the restore operation .
- -n — (Precommit with no installation of VxVM disk header) Loads the disk group configuration only. It specifies that no corrupted private region headers should not be reinstalled.
- -l <directory> — To Specify a directory other than the default (/etc/vx/cbr/bk) where the backup configuration files need to be saved.
- -p (Precommit: load) Loads disk group configuration along with corrupted disk headers (reinstalled).
- Load the configuration of the 'testdg' disk group from the default directory, and reinstall disks that have corrupted VxVM disk headers:
# vxconfigrestore -p testdg
- Load the configuration of the 'testdg' disk group from the backup files in the directory /tmp/testdg without reinstalling any disks that have corrupted private region disk headers:
# vxconfigrestore -n -l /tmp/testdg testdg
- Abandon the restoration of the testdg disk group at the precommit stage:
# vxconfigrestore -d testdg
- Commit the restoration of the configuration of the testdg disk group from the backup files in the directory /tmp/testdg:
# vxconfigrestore -c -l /tmp/testdg testdg
- Restore the disk label for a disk disk1 in the disk group testdg from the backup data:
# vxconfigrestore -r testdg disk1