AIX > Administrator > Backup and Recovery

An Inside Look at Online Backups With Internal Snapshots


Editor’s note: This is the second of two articles on snapshots. The first, “Online Backups and Recovery in a Snap,” covers external snapshots, while this covers internal ones.

Clearly, online JFS2 file system backups result in minimal downtime, and one obvious advantage is you can do backups while the application is up. In a nutshell, an internal snapshot works like this: When the snapshot is instigated, it freezes the data so a snapshot of the file system is taken. This snapshot will copy the data blocks using the copy-on-write method. This ensures the snapshot only takes up about 15 to 20 percent of the original file system size. With internal snapshots, however, note that:


  • The attribute to enable an internal snapshot can only be done at file system creation.
  • The snapshots reside within the original file system.
  • It cannot be mounted as a separate file system.
  • The data area of the snapshot is read-only.
  • If you run out of space on the snapshot, all snapshots will be unusable.
  • An internal and external snapshot cannot coexist on the same file system.

Creating Snapshots

You can have up to 64 internal snaps. I never have more than five or six saved at one time, though; after that, I just recycle.

For an internal snapshot, be sure to check that the ISNAPSHOT attribute has been enabled on the file system by using the lsfs command. If it’s not enabled, a new file system will need to be created with the attribute enabled. The ISNAPSHOT cannot be added to an existing file system. For instance, to check the file system /opt/portal_int, try:

# lsfs -q /opt/portal_int
Name   Nodename Mount Pt    VFS Size Options Auto Accounting
/dev/fslv07  --   /opt/portal_int  jfs2 1048576 rw   yes no 
 (lv size: 1048576, fs size: 1048576, block size: 4096, sparse files: yes, 
inline log: no, inline log size: 0, EAformat: v2, Quota: no, DMAPI: no, VIX: yes,
EFS: no, ISNAPSHOT: yes, MAXEXT: 0, MountGuard: no)

To create an internal snapshot, one common format is:

snapshot -o snapfrom=  -n  

To create a snapshot in the file system /opt/portal_int with the snapshot held internally in /snap_portal_int, that is created on the same logical volume (LV) as the file system, the snapshot name called, /opt/portal_int, try:

# snapshot -o snapfrom=/opt/portal_int -n snap_portal_int
Snapshot for file system /opt/portal_int created on snap_portal_int

The snapshot is held in:

/opt/portal_int/.snapshot/snap_portal_int

To access those files, cd into that directory. However, note that the directory .snapshot can’t be seen with the ls -alt command. To confirm the creation and presence of the snap, use the query option of snapshot command:

# snapshot -q /opt/portal_int
Snapshots for /opt/portal_int
Current Name   Time
* snap_portal_int Sun Nov 4 13:26:12 GMT 2012

In this output, the * denotes the current or most recent snapshot. At this point, let’s take another snapshot of the filesystem /opt/portal_int, this time calling the snapshot name snap_portal_int2:

# snapshot -o snapfrom=/opt/portal_int -n snap_portal_int2
Snapshot for file system /opt/portal_int created on snap_portal_int2

# snapshot -q /opt/portal_int
Snapshots for /opt/portal_int
Current  Name         Time
         snap_portal_int Sun Nov 4 13:26:12 GMT 2012
	*  snap_portal_int2 Sun Nov 4 13:32:12 GMT 2012
	
# pwd
/opt/portal_int/.snapshot
# ls -l
total 0
drwxr-xr-x 3 root  system   256 Nov 04 13:26 snap_portal_int
drwxr-xr-x 3 root  system   256 Nov 04 13:32 snap_portal_int2

If we accidentally remove some files from /opt/portal_int, we can simply copy them over from the snap directory of our choice.

David Tansley is a freelance writer and an IBM Champion.


comments powered by Disqus

Advertisement

Advertisement

2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

AIX > ADMINISTRATOR > BACKUP AND RECOVERY

Backup and Restore With AIX

While there are some strong third-party tools 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.

Business Flexibility and Agility through Application-Driven Data Management

The information that requires the highest priority for backing up—and the greatest precedence for recovery—should be the data most needed by your mission-critical applications.

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters