Previous Page
Next Page

The fssnap Utility

Objective:

Explain how to perform incremental, full, and remote backups to tape for an unmounted file system using the ufsdump command, or explain how to back up a mounted file system using UFS snapshot.

You can use the fssnap command to create a read-only snapshot of a file system while the file system is mounted. A snapshot is a point-in-time image of a file system that provides a stable and unchanging device interface for backups. This snapshot uses the backing-store file. A few important points about the backing-store:

  • The destination path of the backing store files must have enough free space to hold the file system data. The size of the backing store files vary with the amount of activity on the file system.

  • The backing store file location must be different from the file system that is being captured in a snapshot.

  • The backing-store files can reside on any type of file system, including another UFS file system or an NFS file system.

  • Multiple backing-store files are created when you create a snapshot of a UFS file system that is larger than 512 Gbytes.

Unlike ufsdump, fssnap enables you to keep the file system mounted and the system in multi-user mode during backups. The snapshot is stored to disk, and then you can use Solaris backup commands such as ufsdump, tar, and cpio to back up the UFS snapshot. The result is a more reliable backup than you get with ufsdump alone.

When you use the fssnap command to create a file system snapshot, you should observe how much disk space the backing-store file consumes. The backing-store file itself uses no space initially, and then it grows quickly. As activity increases on the original file system, the backing-store file grows. This is because the size of the backing-store is activity related and is not related to the size of the original file system. It holds the original version of blocks that changed while the fssnap was active. If the file system has heavy use, the backing-store file increases in size quickly. On a heavily used file system, you need to make sure the backing-store file has enough space to grow.

Note

Disk Space for the Backing-Store File If the backing-store file runs out of disk space, the snapshot might delete itself, thus causing the backup to abort. If you are experiencing problems with the backup, you should examine the /var/adm/messages file for possible snapshot errors.


Step by Step 7.3 describes how to create snapshots.

Step By Step 7.3: Creating Snapshots

1.
Determine which file system you want to create the snapshot of. For this example, assume that you want to create a snapshot of /export/home.

2.
Determine where you are going to store the backing-store file (that is, the snapshot). That file system should be large enough to hold an expanding backing-store file. In this example, you are going to use /var/tmp as a location to store the backing-store file.

3.
Create the snapshot:

fssnap -F ufs -o backing-store=/var/tmp /export/home

backing-store can be abbreviated as bs (for example, bs=/var/tmp).

The system responds with the name of the virtual device that is created:

/dev/fssnap/0

4.
Now you can back up the file system to tape (/dev/rmt/0) by specifying the virtual device (/dev/fssnap/0), as follows:

ufsdump 0ucf /dev/rmt/0 /dev/fssnap/0

The virtual device /dev/fssnap/0 is described later in this section.


Here's what happens after you create the snapshot by using the fssnap command. A file, the backing-store file, is created in the /var/tmp file system. It's a normal file that can be listed just like any other file, by using the ls command:

ls -l /var/tmp

The following backing-store file is listed:

-rw-------   1 root     other    196665344 Mar 27 15:05 snapshot0

snapshot0 is the name of the backing-store file. The backing-store file is a bitmapped file that contains copies of presnapshot data that has been modified since the snapshot was taken. When you take the snapshot, the snapshot0 file is created. As the original file system changes, the snapshot's backing-store file is updated, and the backing-store file grows.

Note

Limiting the Size of the Backing-Store File You can limit the size of the backing-store file by using the maxsize option, as follows:

fssnap -F ufs -o maxsize=600m,backing-store=/var/tmp /export/home

In this example, the size of the backing-store file is limited to 600MB; however, the backing-store file is a sparse file, which actually uses less disk space than the file system it represents


In addition, after you execute the fssnap command, two read-only virtual device files are created:

  • /dev/fssnap/0 Block virtual device

  • /dev/rfssnap/0 Raw virtual device

The virtual devices look and act like standard read-only devices, and you can use any of the existing Solaris commands with them. For example, you can mount the block virtual device by using the mount command, as follows:

mount -F ufs -o ro /dev/fssnap/0 /mnt

Note

Mounting the Snapshot Because the virtual devices are read-only, you need to mount the snapshot as read-only by using the -o ro option to the mount command.


You can go into the mount point and view the contents of the snapshot with the following:

ls -l /mnt

The contents of the snapshot are displayed:

total 3810
drwxr-xr-x   2 wcalkins staff        512 Mar 12 14:14 bcalkins
-rw-------   1 root     other    1933312 Mar 27 10:15 dump
drwx------   2 root     root        8192 Feb 26 15:33 lost+found

In this case, there wasn't much in the file system when the snapshot was created.

Now you can list the contents of the "real" file system named /export/home; remember that this is the live file system from which the snapshot was taken:

ls -l /export/home
total 3810
drwxr-xr-x   2 wcalkins staff        512 Mar 12 14:14 bcalkins
-rw-------   1 root     other    1933312 Mar 27 15:05 dump
-rw-r--r--   1 root     other         12 Mar 27 15:05 file1
drwx------   2 root     root        8192 Feb 26 15:33 lost+found

Notice in this example that things are changing. There is a new file named file1, and the dump file has a new time. The snapshot image, however, remains the way it wasnone of the dates have changed, and none of the new files show up. When you back up the snapshot, you get a backup of the file system the way it was when you made the snapshot. Here's how you back up the snapshot by using the ufsdump command:

ufsdump 0ucf /dev/rmt/0 /dev/rfssnap/0

Notice that you're backing up the virtual device named /dev/fssnap/0. The backup that was created from the virtual device is a backup of the original file system and represents the state of the file system when the snapshot was taken. If you ever need to restore a file system from the backup, restore the data using ufsrestore, as if you had taken the backup directly from the original file system. For this recovery procedure, refer to the section titled "The ufsrestore Facility" earlier in this chapter.

To remove the snapshot, you issue the following command:

fssnap -d  /export/home

/export/home was the name of the file system you created the snapshot of. The system responds with the following:

Deleted snapshot 0

When you create a UFS snapshot, you can specify that the backing-store file be unlinked, which means the backing-store file is removed after the snapshot is deleted. Here's how you do this:

fssnap -F ufs -o unlink,backing-store=/var/tmp /export/home

When you use the unlink option, you cannot see the backing-store file. This might make administration more difficult because the file is not visible in the file system.

Earlier you did not specify the -o unlink option, so you have to delete the backing-store manually, as follows, after you run the fssnap -d command:

rm /var/tmp/snapshot0

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.

Here are a few other facts about snapshots:

  • The size of the backing-store file depends on how much data has changed since the snapshot was taken.

  • A snapshot does not persist across system reboots.

  • Snapshots are meant to be used on UFSs only.

For more information on options that can be used with the fssnap command to list and manage snapshots, refer to the man pages for fssnap and fssnap_ufs.


Previous Page
Next Page