With data centers moving more towards 24 x 7 operations
it is becoming increasingly difficult to find a window when file systems can
be backed up in a consistent manner. There are many problems associated with
backing up files that are active. In fact, some backup utilities will refuse
to back up files that are open for output. In today's environment it is
often not possible to interrupt access to the data in order to back it up.
A good solution to this problem is to use the capability of
a product called OnLine Journaled File System, also known as
AdvJournalFS. With Online JFS, you can create a snapshot of a
file system and backup the snapshot while the original file system
is active. The snapshot logical volume is created with new options
to the mount command.
No data is actually copied to the snapshot logical volume
unless the original copy is modified. Only those blocks of the
file system that are modified need ever be copied to the snapshot.
Therefore, the snapshot logical volume can be much smaller than
the original. The backup is taken of the snapshot, which presents
a "frozen" view of the file system.
When the backup is complete, the snapshot is unmounted and
the logical volume can be reused as a snapshot for another file
system.
The following example demonstrates how to use OnLine JFS to
backup the /home file system:
1. Create a logical volume to be used as a snapshot of the
/home file system. The snapshot does not need to be as large
as the original file system. For example, if /home is 500MB and
you estimate that at most, 10% of the file system will be modified
during the backups, your snapshot only needs to be 52MB (a multiple
of the LVM 4MB extent size):
lvcreate -L 52 -n snaplv /dev/vg01
2. Create a mount point for the snapshot:
mkdir /home.bkp
3. Create the snapshot using the mount command:
mount -F vxfs -o snapof=/home /dev/vg01/snaplv /home.bkp
At this point the files that you would see when traversing
the /home.bkp directory would be identical to the files under
/home. /home.bkp is read only, whereas the files under /home
can be modified. Initially, none of the data from /home is actually
copied to snaplv. This will occur only when, or if, data in /home
is modified.
4. Now it's time to back up the snapshot. I recommend performing
the backup using relative path names. That way, files can more
easily be restored to /home. You can use most of the standard
backup utilities to back up the snapshot. In this example, we'll
use fbackup:
cd /home.bkp
fbackup -i . -f /dev/rmt/0m
5. When the backup completes, unmount the snapshot:
cd /
umount /home.bkp