Edit: Still good to remember
Originally posted August 28, 2018 on AIXchange
How do you backup your volume groups? These days we’re often dealing with snapshots on a SAN, but there are still occasions when you want to backup to a local tape drive, a file, or a NIM server. The specifics depend upon the amount of data and the type of infrastructure we’re dealing with. (Obviously moving terabytes across a 100mb network isn’t the best way to go.)
When backing up rootvg, you’d typically run mksysb. But how would you backup datavg? The best choice is to run savevg:
The savevg command finds and backs up all files belonging to a specified volume group. The volume group must be varied-on, and the file systems must be mounted. The savevg command uses the data file created by the mkvgdata command.
Note: The savevg command will not generate a bootable tape if the volume group is the root volume group. Although the tape is not bootable, the first three images on the tape are dummy replacements for the images normally found on a bootable tape. The actual system backup is the fourth image.
To restore from this backup, run restvg:
The restvg command restores the user volume group and all its containers and files, as specified in the /tmp/vgdata/vgname/vgname.data file (where vgname is the name of the volume group) contained within the backup image created by the savevg command.
The restvg command restores a user volume group. The bosinstall routine reinstalls the root volume group (rootvg). If the restvg command encounters a rootvg volume group in the backup image, the restvg command exits with an error.
If a yes value has been specified in the EXACT_FIT field of the logical_volume_policy stanza of the /tmp/vgdata/vgname/vgname.data file, the restvg command uses the map files to preserve the placement of the physical partitions for each logical volume. The target disks must be of the same size or larger then the source disks specified in the source_disk_data stanzas of the vgname.data file.
Another option is backing up just your volume group structure, which can be used to recreate volume groups and filesystems. This is hugely beneficial if you’re cloning a system to new disks on a new frame where you want the exact same volume groups and filesystems. Simply use the savevgstruct and restorevgstruct backup commands. On the latter:
The restorevgstruct command restores the structure of a previously saved user volume group. If the -ls flag is specified, a list of previously saved volume groups and the date each volume group was saved is displayed. This command does not work on rootvg.
I understand that these concepts are familiar to many of you, but I’m regularly questioned about these things, so I believe it’s a worthy discussion. Hopefully this provides some clarity.