Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 47

Using UFS Snapshots (Tasks)

This chapter describes how to create and back up UFS snapshots.

For information on the procedures associated with creating UFS snapshots, see "Using UFS Snapshots (Task Map)".

For overview information about performing backups, see Chapter 45, Backing Up and Restoring File Systems (Overview).

Using UFS Snapshots (Task Map)

Task

Description

For Instructions

1. Create a UFS snapshot

Create a read-only copy of a file system with the fssnap command.

"How to Create a UFS Snapshot"

2. Display UFS snapshot information

Identify UFS snapshot information such as the raw snapshot device.

"How to Display UFS Snapshot Information"

3. (Optional) Delete a UFS snapshot

Delete a snapshot that is already backed up or no longer needed.

"How to Delete a UFS Snapshot"

4. Back up a UFS snapshot

Choose one of the following backup methods:

 

 

Create a full backup of a UFS snapshot with the ufsdump command.

"How to Create a Full Backup of a UFS Snapshot (ufsdump)"

 

Create an incremental backup of a UFS snapshot with the ufsdump command.

"How to Create an Incremental Backup of a UFS Snapshot (ufsdump)"

 

Back up a UFS snapshot with the tar command.

"How to Back Up a UFS Snapshot (tar)"

5. (Optional) Restore data from a UFS snapshot

Restore the UFS snapshot the same way as you would restore data with the ufsrestore command.

"How to Restore a Complete File System"

UFS Snapshots Overview

The Solaris 9 release includes the 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™ 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 is 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 8 1/01, 4/01, 7/01, 10/01, and 10/02 releases and the Solaris 9 release

Part of Sun StorEdge products

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 UFS 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 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 and Deleting UFS Snapshots

When you use the fssnap command to create a UFS 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.


Caution - 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.


For more information, see fssnap_ufs(1M).

How to Create a UFS Snapshot

  1. Become superuser or assume an equivalent role.

  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 /backing-store-file
  4. Create the UFS snapshot.

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

    Note - The backing-store file must reside on a different file system than the file system that is being snapshot.


  5. Verify that the snapshot has been created.

    # /usr/lib/fs/ufs/fssnap -i /file-system

Examples--Creating a UFS Snapshot

The following example shows how to create 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 shows how to limit 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 UFS snapshots and their corresponding virtual devices.


Note - Use the UFS file system-specific fssnap command to view the extended snapshot information as shown in the following examples.


  1. Become superuser or assume an equivalent role.

  2. List current snapshots.

    # /usr/lib/fs/ufs/fssnap -i
    Snapshot number               : 0
    Block Device                  : /dev/fssnap/0
    Raw Device                    : /dev/rfssnap/0
    Mount point                   : /export/home
    Device state                  : idle
    Backing store path            : /var/tmp/bs.file
    Backing store size            : 0 KB
    Maximum backing store size    : Unlimited
    Snapshot create time          : Wed Aug 29 15:22:06 2001
    Copy-on-write granularity     : 32 KB

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

    # /usr/lib/fs/ufs/fssnap -i /usr
    Snapshot number               : 0
    Block Device                  : /dev/fssnap/0
    Raw Device                    : /dev/rfssnap/0
    Mount point                   : /usr
    Device state                  : idle
    Backing store path            : /var/tmp/bs.file
    Backing store size            : 0 KB
    Maximum backing store size    : Unlimited
    Snapshot create time          : Wed Aug 29 15:23:35 2001
    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 that 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.

 
 
 
  Previous   Contents   Next