On AIX, the savevg command can be used to back up non-root volume groups and their contents. The volume group structure can be recreated from the savevg archive. Other data backups might be need to be applied to bring the data up to date. Should an entire disk group be lost, this would need to be manually recreated or cloned if appropriate disk group configuration has been previously collected. Backup of data in disk groups can be done manually or automatically through the use of software such as VERITAS NetBackup or Tivoli Storage Manager.
Here are the requirements of the savevg command:
- Volumes backed up using the savevg command must be varied on and have their filesystems mounted.
- savevg cannot back up remotely mounted NFS and CIFS filesystems.
- Filesystems must be of type JFS or JFS2.
If you ever need to build multiple servers that will all have the same volume groups, logical volumes, and filesystems you can use “savevg” and “restvg” to save yourself a bunch of time and duplicated work. This also works if you are ever asked to build a new server that should be setup with the same VG/LV/FS’s as an older server.
You start by setting up one of the servers with the volume groups, logical volumes, and filesystems that you will need. Next you can use the “savevg -r” command to backup just the volume group/LV/Filesystem structure information. With the “-r” flag it doesn’t backup any data in the filesystems, which makes it quick and the backup file very small.
In this example we want to duplicate the “appvg” structure on to another server:
# lsvg -l appvg appvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT loglv02 jfs2log 1 1 1 open/syncd N/A applv05 jfs2 52 52 4 open/syncd /app5 fslv05 jfs2 25 50 2 open/syncd /app2 loglv03 jfslog 1 1 1 closed/syncd N/A
# savevg -r -f /appvg.savevg appvg Creating information file for volume group appvg................................................................. Backing up user Volume Group information files only. Creating list of files to back up. Backing up 6 files 6 of 6 files (100%) 0512-038 savevg: Backup Completed Successfully.
Next you copy the “/appvg.savevg” file on to all the servers that you want to setup the VG/LV/FS’s on. You can use something like “scp” or “sftp” or another protocol to transfer the file.
On the other servers, you run “restvg” to restore the VG/LV/FS structures from the file:
# restvg -r -f /appvg.savevg hdisk1 hdisk2 Will create the Volume Group: appvg Target Disks: hdisk1 hdisk2 Allocation Policy: Shrink Filesystems: no Preserve Physical Partitions for each Logical Volume: no Enter y to continue: y 0516-1254 /usr/sbin/mkvg: Changing the PVID in the ODM. appvg loglv02 applv05 fslv05 loglv03
# lsvg -l appvg appvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT loglv02 jfs2log 1 1 1 open/syncd N/A applv05 jfs2 52 52 2 open/syncd /app5 fslv05 jfs2 25 50 2 open/syncd /app2 loglv03 jfslog 1 1 1 closed/syncd N/A
As you can see the “restvg -r” command restored the volume group, logical volumes, and filesystems, and even mounts the filesystems for you! Note that the fslv05 LV was mirrored before on the original server and when restored it is still mirrored. The original volume group on the source server was on 4 hdisks, but on the destination server only had 2 hdisks. But this isn’t a problem, restvg is able to take care of it as long as you have enough disks to accommodate the mirroring and enough total space for all the logical volumes. You can even use the “-s” flag on restvg to attempt to shrink the filesystems if the destination hdisks aren’t large enough to hold all the original LV’s.