AnswerBook2
Personal Library Contents Print Options Help
 Search in:     Tips
Solaris 8 10/01 Update Collection  >>  Solaris 8 System Administration Supplement 

Backing Up File Systems With fssnap

The fssnap command is new in the Solaris 8 1/01 release. The following information supplements information on backing up file systems that is in "Backing Up and Restoring File Systems (Overview)" in the System Administration Guide, Volume 1.


Note:  

For the most current man pages, use the man command. The Solaris 8 Update release man pages include new feature information that is not in the Solaris 8 Reference Manual Collection.


UFS Snapshots Overview

The Solaris 8 1/01 release includes the new fssnap command for backing up file systems while the file system is mounted.

You can use the fssnap command to create a read-only snapshot of a file system. A snapshot is a file system's temporary image that is intended for backup operations.

When the fssnap command is run, it creates a virtual device and a backing-store file. You can back up the virtual device, which looks and acts like a real device, with any of the existing Solaris backup commands. The backing-store file is a bitmapped file that contains copies of pre-snapshot data that has been modified since the snapshot was taken.

Why Use UFS Snapshots?

UFS snapshots enables you to keep the file system mounted and the system in multiuser mode during backups. Previously, you were advised to bring the system to single-user mode to keep the file system inactive when you used the ufsdump command to perform backups. You can also use additional Solaris backup commands like tar and cpio to back up a UFS snapshot for more reliable backups.

The fssnap command gives administrators of non-enterprise-level systems the power of enterprise-level tools like Sun StorEdge(TM) Instant image without the large storage demands.

UFS snapshots is similar to the Instant Image product. Instant Image allocates space equal to the size of the entire file system that is being captured. However, the backing-store file that was created by UFS snapshots occupies only as much disk space as needed, and you can place a maximum size on the backing-store file.

This table describes specific differences between UFS snapshots and Instant Image.

UFS Snapshots

Instant Image

Size of the backing-store file depends on how much data has changed since the snapshot was taken

Size of the backing-store file equivalent equals the size of the entire file system being copied

Does not persist across system reboots

Persists across system reboots

Works on UFS file systems

Cannot be used with root (/) or /usr file systems

Part of the Solaris 1/01 release

Part of the Enterprise Services Package

Although UFS snapshots can make copies of large file systems, Instant Image is better suited for enterprise-level systems. UFS snapshots is better suited for smaller systems.

UFS Snapshots Performance Issues

When the file-system snapshot is first created, users of the file system might notice a slight pause. The length of the pause increases with the size of the file system to be captured. While the file-system snapshot is active, users of the file system might notice a slight performance impact when the file system is written to, but they will see no impact when the file system is read.

Creating UFS Snapshots

When you use the fssnap command to create a file-system snapshot, observe how much disk space the backing-store file consumes. The backing-store file uses no space, and then it grows quickly, especially on heavily used systems. Make sure the backing-store file has enough space to grow, or limit its size with the -o maxsize=n [k,m,g] option, where n [k,m,g] is the maximum size of the backing-store file.


CautionCaution - 

If the backing-store file runs out of space, the snapshot might delete itself, which causes the backup to fail. Check the /var/adm/messages file for possible snapshot errors.


How to Create a UFS Snapshot

  1. Become superuser.

  2. Make sure that the file system has enough disk space for the backing-store file.


    # df -k
  3. Make sure that a backing-store file of the same name and location does not already exist.


    # ls /file-system/backing-store-file
  4. Create the file-system snapshot.


    # fssnap -F ufs -o bs=/file-system/backing-store-file /file-system

Examples--Creating a UFS Snapshot

The following example creates a snapshot of the /usr file system. The backing-store file is /scratch/usr.back.file, and the virtual device is /dev/fssnap/1.


# fssnap -F ufs -o bs=/scratch/usr.back.file /usr /dev/fssnap/1

The following example limits the backing-store file to 500 Mbytes.


# fssnap -F ufs -o maxsize=500m,bs=/scratch/usr.back.file /export/home /dev/fssnap/1

How to Display UFS Snapshot Information

You can display the current snapshots on the system by using the fssnap -i option. If you specify a file system, you see detailed information about that snapshot. If you don't specify a file system, you see information about all of the current file-system snapshots and their corresponding virtual devices.

  1. Become superuser.

  2. List current snapshots.


    # fssnap -i 0 / 1 /usr

    To display detailed information about a specific snapshot, use the following:


    # fssnap -i /usr Snapshot number : 1 Block Device : /dev/fssnap/1 Raw Device : /dev/rfssnap/1 Mount point : /usr Device state : idle Backing store path : /scratch/usr.back.file Backing store size : 480 KB Maximum backing store size : Unlimited Snapshot create time : Tue Aug 08 09:57:07 2000 Copy-on-write granularity : 32 KB

Deleting a UFS Snapshot

When you create a UFS snapshot, you can specify that the backing-store file is unlinked, which means the backing-store file is removed after the snapshot is deleted. If you don't specify the -o unlink option when you create a UFS snapshot, you will have to delete it manually.

The backing-store file occupies disk space until the snapshot is deleted, whether you use the -o unlink option to remove the backing-store file or you remove it manually.

How to Delete a UFS Snapshot

You can delete a snapshot either by rebooting the system or by using the fssnap -d command and specifying the path of the file system that contains the file-system snapshot.

  1. Become superuser.

  2. Identify the snapshot to be deleted.


    # fssnap -i
  3. Delete the snapshot.


    # fssnap -d /file-system Deleted snapshot 1.
  4. (Optional) If you did not use the -o unlink option when you created the snapshot, you need to delete the backing-store file manually.


    # rm /file-system/backing-store-file

Example--Deleting a UFS Snapshot

The following example deletes a snapshot and assumes that the unlink option was not used.


# fssnap -i 0 / 1 /usr # fssnap -d /usr Deleted snapshot 1. # rm /scratch/usr.back.file

Backing Up a UFS Snapshot

The virtual device that contains the file-system snapshot acts as a standard read-only device. This means you can back up the virtual device as if you were backing up a file-system device.

If you are using the ufsdump command to back up a UFS snapshot, you can specify the snapshot name during the backup. See the following section for more information.

If you are using the tar command to back up the snapshot, mount the snapshot before backing it up, like this:


# mkdir /backups/home.bkup # mount -F UFS -o ro /dev/fssnap/1 /backups/home.bkup # cd /backups/home.bkup # tar cvf /dev/rmt/0 .

For more information on how to back up a file system see "Backing Up Files and File Systems (Tasks)" in the System Administration Guide, Volume 1.

How to Back Up a UFS Snapshot

  1. Become superuser.

  2. Identify the file-system snapshot to be backed up.


    # fssnap -i /file-system

    For example:


    # fssnap -i /usr Snapshot number : 1 Block Device : /dev/fssnap/1 Raw Device : /dev/rfssnap/1 Mount point : /usr Device state : idle Backing store path : /scratch/usr.back.file Backing store size : 480 KB Maximum backing store size : Unlimited Snapshot create time : Tue Aug 08 09:57:07 2000 Copy-on-write granularity : 32 KB
  3. Back up the file-system snapshot.


    # ufsdump 0ucf /dev/rmt/0 /snapshot-name

    For example:


    # ufsdump 0ucf /dev/rmt/0 /dev/rfssnap/1
  4. Verify the snapshot is backed up.


    # ufsrestore ta /dev/rmt/0

How to Create an Incremental Dump of a UFS Snapshot

If you want to create a file-system snapshot incrementally, which means only the files that have been modified since the last snapshot are backed up, use the ufsdump command with the new N option. This option specifies the file-system device name to be inserted into the /etc/dumpdates file for tracking incremental dumps.

The following ufsdump command specifies an embedded fssnap command to create an incremental dump of a file system.

  1. Become superuser.

  2. Create an incremental dump of a file-system snapshot.


    # ufsdump 1ufN /dev/rmt/0 /dev/rdsk/c0t1d0s0 `fssnap -F ufs -o raw,bs= /export/scratch,unlink /dev/rdsk/c0t1d0s0`

    The -o raw option is used in the example to display the name of the raw device instead of the block device. By using this option, you make it easier to embed the fssnap command in commands that require the raw device instead, such as the ufsdump command.

  3. Verify the snapshot is backed up.


    # ufsrestore ta /dev/rmt/0

Restoring Data From a UFS Snapshot Backup

The backup created from the virtual device is essentially just a backup of what the original file system looked like when the snapshot was taken. When you restore from the backup, restore as if you had taken the backup directly from the original file system, such as one that used the ufsrestore command. For more information on restoring file systems, see "Restoring Files and File Systems (Tasks)" in the System Administration Guide, Volume 1.

Next Topic

Managing Removable Media Topics

Other Topics in: Solaris 8 System Administration Supplement

Managing File Systems With UFS Software
You are here Backing Up File Systems With fssnap
UFS Snapshots Overview
Creating UFS Snapshots
Deleting a UFS Snapshot
Backing Up a UFS Snapshot
Managing Removable Media Topics
Managing Removable Media
 
 
Book Table of Contents Complete Table of Contents for Book


Copyright 2000 Sun Microsystems, Inc. All rights reserved.