Question & Answer
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 made to the source system, such as a data write 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:
In the lsfs -q output, the size is reported in 512-byte blocks. In the preceding example the filesystem and logical volume are 2 Gb in size. We'll make the snapshot filesystem 204 Mb (10% of the original).
* Mounting a snapshot
* Finding out if a JFS2 filesystem has a snapshot already
* Deleting a snapshot
NOTES:
As long as the original filesystem is mounted, the snapshot logical volume will show "open", even if the snapshot logical volume is not mounted. You will not be able to remove the snapshot logical volume using the rmlv command.
Unmounting the source filesystem will close BOTH logical volumes.
If you're unsure whether a logical volume is a JFS2 filesystem snapshot, you can check the superblock using the dumpfs command.
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 made to the source system, such as a data write 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 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. In the preceding example the filesystem and logical volume are 2 Gb in size. We'll make the snapshot filesystem 204 Mb (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 JFS2 filesystem 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
NOTES:
As long as the original filesystem is mounted, the snapshot logical volume will show "open", even if the snapshot logical volume is not mounted. You will not be able to remove the snapshot logical volume using the rmlv command.
# lsvg -l testvg testvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT loglv00 jfs2log 1 1 1 open/syncd N/A fslv02 jfs2 256 256 1 open/syncd /origfs fslv05 jfs2 26 26 1 open/syncd N/A # rmlv -f fslv05 0516-1008 rmlv: Logical volume fslv05 must be closed. If the logical volume contains a filesystem, the umount command will close the LV device.
Unmounting the source filesystem will close BOTH logical volumes.
# lsvg -l testvg testvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT loglv00 jfs2log 1 1 1 closed/syncd N/A fslv02 jfs2 256 256 1 closed/syncd /origfs fslv05 jfs2 26 26 1 closed/syncd N/A
If you're unsure whether a logical volume is a JFS2 filesystem snapshot, you can check the superblock using the dumpfs command.
# dumpfs /dev/fslv05 | head -6 /dev/fslv05: Snapshot Superblock Snapshot created Fri Apr 21 08:30:36 2006
[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Not Applicable","Platform":[{"code":"PF002","label":"AIX"}],"Version":"5.3;6.1;7.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Was this topic helpful?
Document Information
Modified date:
06 December 2019
UID
isg3T1010933