Using savevg on AIX to save time creating filesystems, LV's and volume groups
brian_s 270002K5X3 Visits (14817)
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:
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:
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.