This technote gives information about using sbsnapshot that supplements the SysBack manual.
SysBack (IBM Storage Manager for System Backup and Recovery) added functionality to take advantage of AIX snapshots, introduced at AIX 5.2 to make a point-in-time image of a JFS2 filesystem that you can then use for backup purposes. User and system access to the original JFS2 Filesystem is maintained while SysBack accesses the snapshot copy for backup, with little or no down time for the filesystem.
For example, use sbsnapshot to backup database files. If you quiesce the database before you take the snapshot, you can bring the database back up after the snapshot operation is completed and before SysBack backup begins, with minimal downtime for the database. SysBack will read changed blocks from the snapshot, and unchanged blocks from the original filesystem, resulting in a backup of the original filesystem as it was at the time of the snapshot.
Using sbsnapshot does not reduce the load on the original filesystem, as reads of unchanged blocks still occur on the original filesystem. However, it does reduce or eliminate downtime for the filesystem during backups. sbsnapshot also does not prevent loss of data in case of disk loss of the disk containing either the original filesystem or the snapshot during the backup period; you will still need to go to a previous backup in order to be able to restore, the same as if you were running standard SysBack backups.
It is highly recommended that you verify with your database or other application that it supports restores from AIX snapshots, and that you test backups and restores in your environment.
The purpose of this technote is to give additional information about using sbsnapshot; it does not replace information given in the manual.
Read the following references:
SysBack 6.1 manual, Chapter: Snapshot Backups
TSM 5.5 InfoCenter: Storage Manager for System Backup and Recovery -> Snapshot Backups
DeveloperWorks article: Using JFS2 snapshots on AIX 6.1
sbsnapshot works only on JFS2 filesystems, as is required for AIX snapshots.
How it works
sbsnapshot creates an AIX snapshot of a logical volume. If a block changes, AIX copies the original version of the block to the snapshot location; unchanged blocks stay in the original filesystem. The amount of space needed for a snapshot depends on how many blocks in the filesystem change during the time of the backup. When you run sbsnapshot, you can specify a backup command script to run SysBack backups; if no command script is specified, it will shell out to an AIX prompt, where you can run sysback or other AIX commands. If you run a SysBack backup, it will read changed blocks from the original copy stored in the snapshot and unchanged blocks from the original filesystem.
Backup command script
In most cases, you'll create a backup command script, then run sbsnapshot invoking the backup command script. It's easiest to create a backup command script from smitty sb_snapshot. By default the commands will be stored in /usr/lpp/sysback/sbsnapshot, though you can save them in any location you like. It's convenient to leave them in the default location, so you don't have to specify the full path to the command script. You can run any type of backup: system, volume group, logical volume, filesystem or regular directory or file.
For details on creating command scripts from smitty sb_snapshot, see the SysBack 6.1 manual here:
SysBack -jR flag
The SysBack backup command created from smitty sb_snapshot includes a flag: -jR $1
This tells SysBack to backup relative to the snapshot mounted on the directory fed to the command by sbsnapshot. When you run sbsnapshot, it creates a directory name /<pid>snapshot, where it mounts the snapshots for each filesystem that is snapped. For example, if you specify /test1 and test2 in sbsnapshot, then by default it will store original copies of unchanged blocks in /12345snapshot/test1 and /12345snapshot/test2 respectively. It also feeds the name of the snapshot directory /<pid>snapshot to the backup command file as the argument $1. The -jR flag tells SysBack to backup the filesystems relative to the snapshot directory, for example it will backup /test1 relative to /12345snapshot/test1. If the filesystem has not been snapped, it will backup the filesystem normally.
If you create an AIX snapshot without using sbsnapshot, it's possible to use the -jR flag to run backups relative to the AIX snapshot. For example, if you create an AIX snapshot of test1 and mount it an /mnt/test1, you can run SysBack backups relative to the AIX snap. For example, a volume group backup of datavg that backs up relative to the snap would be:
# mkvgback -jR /mnt -f /dev/rmt0 -x -W -u datavg
Choose the JFS2 logical volumes you want to take snapshots of and decide if you want to run a backup command script, or shell out to AIX. For example, use smitty sb_snapshot to create a backup command script named sbsnapshot_vg in the /usr/lpp/snapshot/sbsnapshot that runs a backup of datavg volume group using the command:
# mkvgback -jR $1 -f /dev/rmt0 -x -W -u datavg
To take a snapshot of /test1 mounted on logical volume fslv00 and run the backup command script run:
# sbsnapshot -B sbsnapshot_vg -v fslv00
This will backup the entire datavg, and backup filesystem /test1 relative to the snapshot of /test1.
If you don't invoke a backup script with the -B option, sbsnapshot will shell you out to an AIX command prompt, where you can run any AIX command you like, including SysBack commands.
Processing: For details on sbsnapshot processing steps, see the SysBack 6.1 manual here:
Cleanup utilities: Although sbsnapshot usually automatically removes the snapshot mount and logical volume, if needed, you can use cleanup utilities to remove them when they are not cleaned up automatically. See the Sysback 6.1 manual here for details:
Restores: Restore from backups run during sbsnapshot the same as for standard SysBack backups, depending on the command you run for backups.
For example, to recreate and restore the files in the /test1 filesystem from the rootvg backup taken from the snap, run:
# sysrestore -f /dev/rmt0 -t F -vx -R /test1