Linux menu

Friday, September 4, 2015

Backuping the mounted file system an UFS snapshot and UFSdump I

Creating a UFS Snapshot

Use fssnap command to create, query, or delete temporary read-only snapshots of ufs file systems.


Syntax to create a UFS snapshot:


# fssnap -F ufs -o bs=backing_store_path /file-system


Note – The backing_store_path can be a raw device, the name of an existing directory, or the name of a file that does not already exist.


Example:

# fssnap -F ufs -o bs=/var/tmp /export/home    ==> to create a snapshot of
                            /export/home file system


Limiting the Size of the Backing-Store File

To limit the backing-store file to 500 Mbytes

# fssnap -F ufs -o bs=/var/tmp,maxsize=500m /export/home


Displaying Information for a ufs File System Snapshot

# fssnap -i    ==> to list all current UFS snapshots on the system


# /usr/lib/fs/ufs/fssnap -i /export/home   ==> to display detailed
                           information for a specific UFS                                snapshot



Backing Up the UFS Snapshot File

Use the tar command or the ufsdump command to back up a UFS snapshot.


Using the tar Command to Back Up a Snapshot File

Mount the snapshot before backing it up

1. Create the mount point for the block virtual device.

# mkdir -p /backups/home.bkup

2. Mount the block virtual device to the mount point.

# mount -F ufs -o ro /dev/fssnap/0 /backups/home.bkup

3. Change directory to the mount point.

# cd /backups/home.bkup

4. Use the tar command to write the data to tape.

# tar cvf /dev/rmt/0 .



Using the ufsdump Command


Specify the raw virtual device during the backup

# ufsdump 0uf /dev/rmt/0 /dev/rfssnap/0

# ufsdump 0ufN /dev/rmt/0 /dev/rdsk/c0d1s7 /dev/rfssnap/0


Verify that the UFS snapshot is backed up.

# ufsrestore tf /dev/rmt/0    ==> t - to list the table of contents of the                         backup media



Performing an Incremental Backup Using a UFS Snapshot

To create an incremental backup of a snapshot

# ufsdump 1ufN /dev/rmt/0 /dev/rdsk/c0d1s7 /dev/rfssnap/0


Use the ufsdump command with the N option to create an incremental UFS snapshot, which writes the name of the device being backed up, rather than the name of the snapshot device to the /etc/dumpdates file.

Note – It is important to note the use of the N argument when backing up
a snapshot. This argument ensures proper updates to the /etc/dumpdates file.


To verify that the UFS snapshot is backed up to tape

# ufsrestore tf /dev/rmt/0


Performing incremental backups of snapshots


1. Create a snapshot of the /extra file system that is going to be
   backed up while the file system is mounted.

# fssnap -o bs=/var/tmp /extra


2. Verify that the snapshot was successful, and view detailed
   information about the snapshot.

# fssnap -i

# /usr/lib/fs/ufs/fssnap -i /extra


3. Make a directory that will be used to mount and view the snapshot
   data.

# mkdir /extrasnap


4. Mount the snapshot to the new mount point, and compare the size of
   the file system and the snapshot device.

# mount -o ro /dev/fssnap/0 /extrasnap

# df -k | grep extra

/dev/dsk/c0d1s3    1294023       9 1242254 1% /extra
/dev/fssnap/0      1294023       9 1242254 1% /extrasnap


5. Edit a file under the /extra directory and make it larger, and then
   compare the size of the file system and the snapshot device.

# df -k |grep extra

/dev/dsk/c0d1s3   1294023 20 1242243 1% /extra
/dev/fssnap/0     1294023  9 1242254 1% /extrasnap

Observe that the file system grew in size while the snapshot file did not.


6. Perform a full backup with the N option of the ufsdump command.

# ufsdump 0ufN /dev/rmt/0 /dev/rdsk/c0d1s3 /dev/rfssnap/0


7. Verify the backup.

# ufsrestore tf /dev/rmt/0


8. Unmount the back up device and remove the snapshot & backing-store file.

# umount /extrasnap

# fssnap -d /extra

# rm /var/tmp/snapshot0


9. Make some changes to the /extra file system, such as copying some
   files, and then re-create the snapshot.

# fssnap -o bs=/var/tmp /extra


10. Re-mount the snapshot device, and compare the size of the file
    system and the snapshot device.

# mount -o ro /dev/fssnap/0 /extrasnap

# df -k | grep extra

/dev/dsk/c0d1s3    1294023      46 1242217 1% /extra
/dev/fssnap/0      1294023      46 1242217 1% /extrasnap


11. Perform an incremental backup with the N option of the ufsdump
    command.

# ufsdump 1ufN /dev/rmt/0 /dev/rdsk/c0d1s3 /dev/rfssnap/0


12. Verify the backup.

# ufsrestore tf /dev/rmt/0

Notice that the backup of the snapshot contains only the files that were added since the previous Level 0 backup.



Restoring Data From a UFS Snapshot Backup

Data written to a tape by ufsdump is simply data, whether it is a snapshot or a file system.

Restore a UFS snapshot from a backup tape in the same manner as you would from the backup of an original file system.



Deleting a UFS Snapshot

1. First, unmount the snapshot device
2. Delete the snapshot
3. Finally remove the backing-store file.

# umount /dev/fssnap/0

# fssnap -d /export/home

# rm /backing_store_file

No comments: