Tape Storage: An Oldie but a Goodie

Edit: Good information.

Originally posted August 2011 by IBM Systems Magazine

As much as we like to tell ourselves that older technology is becoming obsolete, I still see fax machines, dot-matrix printers, dumb terminals, and tape drives out in the wild. Some will argue that we should be doing disk-to-disk backups and eliminate tape entirely, but when it comes to cost per GB and the ease of storage and transport, tape isn’t going away any time soon.

We recently had a customer that is new to AIX ask how we could back up all of its volume groups onto a single tape so it wouldn’t need an automatic tape changer, thus eliminating the need to handle more tapes than necessary.

The organization had multiple volume groups, including its rootvg, and it wasn’t using more space on disk than would fit on one tape. So the question was, “How could the customer get all of those volume groups and all of the data onto a single tape?” Basically, it needed to append all of the other volume groups onto the tape after the mksysb was done.

Search for a Solution

Looking online, I found someone else had the same question in a forum. “Is it possible to use AIX’s mksysb and savevg to create a bootable tape with the rootvg and then append all the other VGs?”

To create the backup, one astute responder suggested a script similar to this one:

tctl -f /dev/rmt0 rewind
/usr/bin/mksysb -p -v /dev/rmt0.1
/usr/bin/savevg -p -v -f /dev/rmt0.1 vg01
/usr/bin/savevg -p -v -f /dev/rmt0.1 vg02
/usr/bin/savevg -p -v -f /dev/rmt0.1 vg03
tctl -f /dev/rmt0 rewind

The script’s author stated:

  • mksysb backs up rootvg and creates a bootable tape.
  • Using “rmt0.1” prevents auto-rewind after operations.

He went on to explain restore procedures, for rootvg, boot from tape and follow the on-screen prompts (a normal mksysb restore). For the other volume groups:

tctl -f /dev/rmt0.1 rewind
tctl -f /dev/rmt0.1 fsf 4
restvg -f /dev/rmt0.1 hdisk[n]

“fsf 4” will place the tape at the first saved VG following the mksysb backup. Use “fsf 5” for the 2nd, “fsf 6” for the 3rd, and so on.

If restvg complains about missing disks, you can add the “-n” flag to forego the “exact map” default parameter. If you need to recover single files, the writer suggested:

tctl -f /dev/rmt0 rewind
restore -x -d -v -sf -f /dev/rmt0.1 ./path/file

In addition, I recommend adding a tctl offline or rewoffl at the end of the script to eject the tape. Otherwise, you will have a bootable tape sitting in your system. And, depending on your bootlist, if the machine restarts you could boot off of the tape, or if someone forgets to swap the tapes, you will overwrite it.

Exclusivity

If your data set nearly fits on a single tape, you can use /etc/exclude.rootvg and /etc/exclude.vg01 to exclude files and directories that we don’t need to back up. If there’s some scratch data on the system that doesn’t need to be backed up and restored, just exclude it.

This mksysb documentation tells us that the tape format includes a boot image, a bosinstall image and an empty table of contents, followed by the system backup (root volume group) image. The root volume group image is in backup-file format, starting with the data files and then any optional map files. In order to exclude files, it explains:

Use -e to exclude files listed in the /etc/exclude.rootvg file from being backed up. The rules for exclusion follow the pattern-matching rules of the grep command.

To exclude certain files from the backup, create the /etc/exclude.rootvg file, with an ASCII editor, and enter the patterns of file names to exclude in your system backup image. The patterns in this file are input to the pattern matching conventions of the grep command to determine which ones will be excluded from the backup. If you want to exclude files listed in the /etc/exclude.rootvg file, select the Exclude Files field and press the Tab key once to change the default value to yes.

  • For example, to exclude all of the contents of the directory called scratch, edit the exclude file to read:
/scratch/
  • To exclude the contents of the directory called /tmp and avoid excluding any other directories that have /tmp in the path name, edit the exclude file to read:
^./tmp/

All files are backed up relative to . (current working directory). To exclude any file or directory for which it is important to have the search match the string at the beginning of the line, use the ^ (caret character) as the first character in the search string, followed by . (dot character), followed by the filename or directory to be excluded. If the filename or directory being excluded is a substring of another filename or directory, use the ^. (caret character followed by dot character) to indicate that the search should begin at the beginning of the line and use the $ (dollar sign character) to indicate that the search should end at the end of the line.

A Viable Option

Obviously, the ability to backup an entire system onto a single tape only works in smaller shops with smaller amounts of data to back up, but there are still quite a few around today. While we like to think everyone is working in large enterprise data centers with around-the-clock operations staff, and dedicated storage, network and server teams, plenty of smaller customers have small staffs and small data sets where this idea might come in handy.