Your Ad Here

IBM AIX/UNIX system storage administration ksh/perl scripting

Monday, May 25, 2009

JFS2 Snapshot Quick Reference

Question
This document is a quick guide to using snapshots of JFS2 filesystems


Answer
The JFS2 snapshot command will create an image of a filesystem at a point in time, allowing the user to back up data from the snapshot rather than from the original filesystem. This allows backing up data without having to stop using it first.
The concept used in the snapped filesystem is "copy on write". During creation of the snapshot filesystem the source filesystem is quiesced while the copy is made, to insure a proper copy. Then only the filesystem structure is created. When any modification is done to the source system, such as a write of data or delete, the original data is copied into the snapped filesystem.

Usually a snapshot filesystem will only need to be 2-6% of the size of the original filesystem, due to this copy-on-write feature.

* Creating a snapshot:
Find out the size of the filesystem:

# lsfs -q /origfs
Name Nodename Mount Pt VFS Size Options Auto
Accounting
/dev/fslv02 -- /origfs jfs2 4194304 rw,cio no
no
(lv size: 4194304, fs size: 4194304, block size: 4096, sparse files: yes, inline log: no, inline log size: 0, reserved: 0, reserved: 0, DMAPI: no, VIX: yes)

In the lsfs -q output the size is reported in 512-byte blocks. So in the above example the filesystem and logical volume are 2Gb in size. We'll make the snapshot filesystem 204Mb (10% of the original).

# snapshot -o snapfrom=/origfs -o size=419430
Snapshot for file system /origfs created on /dev/fslv05

* Mounting a snapshot:
# mount -v jfs2 -o snapshot /dev/fslv05 /mysnap

* Finding out if a fs has a snapshot already:
# snapshot -q /origfs

Snapshots for /origfs
Current Location 512-blocks Free Time
* /dev/fslv05 419430 418662 Fri Apr 21 08:30:36 PDT 2006

* Deleting a snapshot:

# snapshot -d /dev/fslv05
rmlv: Logical volume fslv05 is removed

For further information see the man page for the snapshot command.

Labels

BlogCatalog