Backup and Restore With AIX
While strong third-party tools are available to you for backup and restore purposes on the AIX OS, don't be afraid of the standard AIX toolset to archive your data.
By Ken Milberg02/01/2011
Most articles on backing up AIX partitions approach the subject tend to focus on database archiving and more sexier subjects like high availability or disaster recovery/business continuity solutions. It’s important to make a distinction between failover systems, disaster-recovery (DR) systems and archival systems. Having either a failover or DR server in no way precludes you from the responsibility of backing up your data. That’s because neither a failover or DR server allows you to selectively restore specific files, directories or an entire partition from a given point in time. In this article I’ll discuss different options, including a discussion on some third-party tools that may fit your needs. These tools must have a strong focus on IBM’s AIX OS, meaning that they aren’t just the by-product of a quick port or a developer that’s been instructed to come out with an AIX version of their software just so they can say they have a cross-platform solution.
As most systems administrators can attest, there is absolutely nothing wrong with using the utilities that come preloaded with your OS to perform standard backup and recovery. While it’s true that in most cases you do get what you pay for, these tools work very well, though they might not scale as well off-the-shelf products you must purchase. I should also point out that using standard OS tools usually means having to rely on several backup utilities in order to properly safeguard all your system data.
There are three ways in which to kick-off AIX utilities for backup: the System Management Interface Tool (known as SMIT or smitty), WebSM and the command line. I strongly suggest you use the command line for utilities such as tar, cpio and even mksysb, though I usually have no problems using SMIT for most of the other utilities.
Some of the archiving commands available to you include:
- mksysb—This is the most important utility you should know. Only mksysb lets you recreate your root volume group. Actually, this command will only back up rootvg. There are many flags that you can use with mksys, so I strongly suggest you look at the man pages and fully understand this powerful utility.
- tar—Tar is usually used to archive files and directories rather than entire filesystems. It allows one to create, view or retrieve archived data from either external media or shared network drives.
- cpio—This command copies from and to archive storage device. It’s often used to copy files from UNIX to AIX systems. Though not as widely used, I prefer using cpio to tar because it can restore empty directories.
- dd—This powerful, albeit rarely used, command allows one to make a block-by-block representation of data. It’s very useful in terms of moving data from disparate environments. Decades ago I remember using dd to move ASCII data from my SCO servers to IBM mainframes in EBCDIC, all with dd.
- savevg—This command backs up data belonging to a specific volume group. In many ways it’s similar to mksysb, but for non-rootvg volume groups.
- alt_disk_install—This utility allows one to actually clone systems. It’s used frequently by administrators that have several physical devices in their rootvg. Cloning allows administrators to upgrade their OS and then fall back to other disks in case of a problem.
- multibos—This command allows the root user to make and preserve two versions of the OS in the root filesystem as bootable copies. This option is only available in AIX 5.3.tl3 and higher.
Let’s look at some of these tools.
If you don’t need to perform a backup of the rootvg but only backup a filesystem or directory, use this syntax:
# tar -cvf /dev/rmt0 /yourdata
This command creates a new archive at the beginning of the /dev/rmt0 tape device and each file is listed during backup.
Restore using the x flag:
# tar xvf /dev/rmt0 /yourdata
In the AIX OS, perhaps the single most important command is mksysb. A little known bit of trivia is that IBM was the first vendor who came up with a utility which provided for a full system restore—mksysb. Its purpose isn’t to back up user data, but to create an installable image of the root volume group (rootvg). To reiterate, user data should be kept out of the rootvg. The format of a mksysb includes:
- Base Operating System boot image
- Base Operating System install image
- Dummy table of contents (TOC)
- Actual data on the volume group
It’s important to note that any user-defined paging spaces, unmounted filesystems and raw devices aren’t backed up in a mksysb, so they need to be recreated. Interestingly enough, the mksysb command uses the backup command to create its archive image:
# mksysb -i /dev/rmt0
This command also creates an /image.data file, which is generated by the mkszfile command. The mkszfile command overwrites the existing /image.data file with new information. The information includes system installation information, logical volume information for the root volume group and filesystem information.
The syntax in using mkszfile is:
# mkszfile -f
With mksysb you can do a complete restore or alternatively selectively restore files. To perform a manual restore of file from a mksysb archive:
# restore -xqvf /dev/rmt0 /myrestorationfile
In this example I’ll use savevg to backup an entire filesystem:
savevg -f /dev/rmt0 oravg
To restore the filesystem on to one of the physical disks:
restvg -f /dev/rmt0 hdisk6
I love Tivoli Storage Manager For System Backup and Recovery, though I admit I liked it more before it was swallowed up by TSM. Among other features it handles multiple volume groups and backups striped over multiple backup devices. It can even restore to a different platform—in this sense it’s more useful than mksysb and savevg. You can even run this tool using SMIT. It also allows you to choose between varying types of backups including full system (installation image), volume group, filesystem, file or directory, and raw logical volumes. It can also backup and restore non-rootvg data.
SBAdmin from Storix is a turnkey solution which lets you rebuild your entire AIX system from the ground up, including LVM. It can individually back up and restore files, directories, filesystems, raw partitions, volume groups, raw logical volumes or the entire system in case of a disaster. Backups can be archived to local or remote tape or disk on any AIX or Linux system. It also has full support for AIX 6.1. SBAdmin records your system and storage configuration with each system backup, allowing you to restore your data to different hardware.
Back Up Your Data
I’ll reiterate that while there are some strong third-party tools available to you, don’t be afraid of the standard AIX toolset to archive your data. If the complexity of your environment requires you to have more options available to you in a more simplistic manner, look into third-party tools, which in many cases function as more of a turn-key backup solution that using standard AIX commands. Whatever you decide to use, make sure you perform daily backups of your critical data. While backing up your data can be tedious, there’s no larger responsibly you have than to back up your data.
Ken Milberg, CATE, PMP, is a diverse IT Professional with 20-plus years of experience.