Technology Level 3, Service Pack 1 for AIX 7.1 introduced a new feature for the mksysb utility. This new feature makes it possible to create consistent mksysb backups of your AIX systems using file system snapshot technology. This feature is also available with Technology Level 9 for AIX 6.1.

 

Previously, when taking a mksysb image of an AIX system, the administrator would often see messages stating the files that were meant to be backed up were now missing (usually transient temporary files) or occasionally there would be issues backing up files that were currently “in use”. Often the administrator would need to quiesce the system in order to take a “clean” backup of the system. And, depending on the size of the system, the time required to perform the backup (with the system offline) was significant.

 

A solution was required to provide the administrator with the ability to create a volume group backup without having to quiesce the system (or volume group). This would allow the backup to complete (without missing any files) and provide a consistent and functionally stable backup.

 

This challenge is easily answered using the file system snapshot technology already built-in to AIX. JFS2 has the ability to create snapshots of a mounted JFS2 file system. This creates a consistent (block-level) image of the file system at a point in time. 

 

The mksysb command has been enhanced to call the snapshot command to create snapshots of the JFS2 file systems (in rootvg) and then use the snapshots to create a mksysb backup.  To enable the snapshot feature, use the new –T flag with the mksysb command.

 

Not surprisingly, a few other AIX ‘backup related’ commands have also benefited from this new feature. The savevg, savewpar, mkcd and mkdvd commands have all been enhanced to accept the new –T flag to enable file system snapshots.

 

The mksysb snapshot feature creates an external snapshot of each of the mounted JFS2 file systems in the root volume group. This requires additional free space in the volume group to create the external logical volumes for each snapshot file system. When the backup is complete, the snapshots are deleted.

 

Note: snapshots are only available for JFS2 file systems. JFS file systems in a volume group will be backed up using traditional methods.

 

Here’s an example of using the –T flag with the mksysb command.

 

After issuing the mksysb command we soon see the message “Creating snapshots”.

 

# oslevel -s

7100-03-01-1341

 

# mksysb -Tvie /mksysb/lpar11-mksysb-snapshot

 

mksysb -Tvie /mksysb/lpar11-mksysb-snapshot

 

Creating information file (/image.data) for rootvg.

 

Creating snapshots.

 

Looking at the output from the df command, we observe several snapshot file systems have been created and mounted.

 

# df

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4         2097152   1694480   20%    11782     6% /

/dev/hd2         8388608   4077360   52%    52184    11% /usr

/dev/hd9var      4194304   3614496   14%     6458     2% /var

/dev/hd3         2097152   2086056    1%       69     1% /tmp

/dev/hd1          131072    130360    1%        5     1% /home

/dev/hd11admin     262144    261384    1%       10     1% /admin

/proc                  -         -    -         -     -  /proc

/dev/hd10opt     2097152   1702160   19%     6991     4% /opt

/dev/livedump     524288    523552    1%        4     1% /var/adm/ras/livedump

/dev/fixeslv    13107200   2050688   85%     1463     1% /fixes

/aha                   -         -    -        18     1% /aha

/dev/mksysblv   13107200  13104544    1%        4     1% /mksysb

/dev/fslv00       131072    124416    6%        -     -  /admin/mksysb.7471128

/dev/fslv01       655360    654336    1%        -     -  /admin/mksysb.7471128/usr

/dev/fslv02       131072    129792    1%        -     -  /admin/mksysb.7471128/var

/dev/fslv03       131072    130304    1%        -     -  /admin/mksysb.7471128/tmp

/dev/fslv04       131072    130304    1%        -     -  /admin/mksysb.7471128/home

/dev/fslv05       131072    130304    1%        -     -  /admin/mksysb.7471128/opt

/dev/fslv06       131072    130304    1%        -     -  /admin/mksysb.7471128/admin

/dev/fslv07       131072    130304    1%        -     -  /admin/mksysb.7471128/var/adm/ras/livedump

/dev/fslv08      1703936   1702400    1%        -     -  /admin/mksysb.7471128/fixes

/dev/fslv09       131072    130304    1%        -     -  /admin/mksysb.7471128/mksysb

 

And we see the corresponding snapshot logical volumes in the root volume group.

 

# lsvg -l rootvg

rootvg:

LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT

hd5                 boot       1       1       1    closed/syncd  N/A

hd6                 paging     8       8       1    open/syncd    N/A

hd8                 jfs2log    1       1       1    open/syncd    N/A

hd4                 jfs2       16      16      1    open/syncd    /

hd2                 jfs2       64      64      1    open/syncd    /usr

hd9var              jfs2       32      32      1    open/syncd    /var

hd3                 jfs2       16      16      1    open/syncd    /tmp

hd1                 jfs2       1       1       1    open/syncd    /home

hd10opt             jfs2       16      16      1    open/syncd    /opt

hd11admin           jfs2       2       2       1    open/syncd    /admin

lg_dumplv           sysdump    16      16      1    open/syncd    N/A

livedump            jfs2       4       4       1    open/syncd    /var/adm/ras/livedump

fixeslv             jfs2       100     100     1    open/syncd    /fixes

mksysblv            jfs2       100     100     1    open/syncd    /mksysb

fslv00              jfs2       1       1       1    open/syncd    N/A

fslv01              jfs2       5       5       1    open/syncd    N/A

fslv02              jfs2       1       1       1    open/syncd    N/A

fslv03              jfs2       1       1       1    open/syncd    N/A

fslv04              jfs2       1       1       1    open/syncd    N/A

fslv05              jfs2       1       1       1    open/syncd    N/A

fslv06              jfs2       1       1       1    open/syncd    N/A

fslv07              jfs2       1       1       1    open/syncd    N/A

fslv08              jfs2       13      13      1    open/syncd    N/A

fslv09              jfs2       1       1       1    open/syncd    N/A

 

Whilst the mksysb backup is still running, we are able to query the status of each snapshot using the snapshot command.

 

# snapshot -q /

Snapshots for /

Current  Location          512-blocks        Free Time

*        /dev/fslv00           131072      123392 Mon Dec  2 12:57:11 2013

 

 

Snapshots for /

Current  Location          512-blocks        Free Time

*        /dev/fslv00           131072      123392 Mon Dec  2 12:57:11 2013

Snapshots for /usr

Current  Location          512-blocks        Free Time

*        /dev/fslv01           655360      646656 Mon Dec  2 12:57:13 2013

Snapshots for /var

Current  Location          512-blocks        Free Time

*        /dev/fslv02           131072      129024 Mon Dec  2 12:57:14 2013

Snapshots for /tmp

Current  Location          512-blocks        Free Time

*        /dev/fslv03           131072      130048 Mon Dec  2 12:57:16 2013

Snapshots for /home

Current  Location          512-blocks        Free Time

*        /dev/fslv04           131072      130304 Mon Dec  2 12:57:17 2013

Snapshots for /opt

Current  Location          512-blocks        Free Time

*        /dev/fslv05           131072      129536 Mon Dec  2 12:57:18 2013

Snapshots for /admin

Current  Location          512-blocks        Free Time

*        /dev/fslv06           131072      130304 Mon Dec  2 12:57:20 2013

Snapshots for /var/adm/ras/livedump

Current  Location          512-blocks        Free Time

*        /dev/fslv07           131072      130304 Mon Dec  2 12:57:21 2013

Snapshots for /fixes

Current  Location          512-blocks        Free Time

*        /dev/fslv08          1703936     1701376 Mon Dec  2 12:57:22 2013

Snapshots for /mksysb

Current  Location          512-blocks        Free Time

*        /dev/fslv09           131072      130304 Mon Dec  2 12:57:24 2013

 

From the mksysb man page:

 

-T = Creates backup by using snapshots. This command applies only to JFS2 file systems. When you specify the -T flag to use snapshots for creating a volume group backup, external JFS2 snapshots are created. Snapshots allow for a point-in-time image of a JFS2 file system and thus, do not require a system to be put into a temporarily inactive state. The size of the snapshot is 2% - 15% of the size of the file system. The snapshot logical volumes are removed when back up is complete. However, snapshots are not removed if a file system already has other snapshots. Additionally, if a file system has internal snapshots, external snapshots cannot be created and thus, snapshots are not used for creating the backup of the file system. The use of the -T flag does not affect any JFS file systems that are present in the volume group that is being backed up. These file systems are backed up in the same manner as done previously.