16.3 Using the File-Level Snapshot Attribute to Enable the Backup of Open Files

This section discusses the following key concepts and tasks:

16.3.1 Understanding File-Level Snapshots

The file snapshot attribute is not the same as the pool snapshot feature. Pool snapshot is an NSS feature that makes block-level snapshots of a pool that persist until intentionally deleted. For information, see Managing NSS Pool Snapshots (NetWare).

File-level snapshot is an attribute of an NSS volume that allows a temporary copy of an open file to be made at the time of a volume backup so that the last-known-good copy of the file is available for backup while the file is in use.

Normally, if a file is open when backup services begin, that open file cannot be backed up. With the file snapshot attribute set for a volume, NSS creates and maintains a virtual volume where it writes a partial or full copy of a file’s original data whenever a file on the source volume is open for write. This temporary copy of the file’s original data is made available to the backup software instead of the current contents of the open file. Consequently, open files can be copied to the backup media, even though changes in progress for the files are not backed up.

All file snapshot activity happens transparently to the user and to non-backup applications. The user and applications always read the current content of the file. The copy of the file is temporary. When the user or API closes the file, NSS deletes the file-snapshot copy.

IMPORTANT:Not all third-party backup software can take advantage of the file snapshot attribute, even if you set it.

16.3.2 Guidelines for Using File-Level Snapshots

The copy-on-write technology used in file-level snapshots is designed for most files that spend their lifetimes in a closed state or read-only state. However, copy-on-write is neither desirable nor useful in the case of database backups, which are perpetually held in an open state for writing. Because the copy occurs when the write call is issued for a block, the copy is not updated if subsequent writes are made to the same block before the file is closed. The longer the database is open, the more out of date the copied block becomes.

For example, in a Novell® GroupWise® system, the longer the database is open, the more chronilogically disjoint the contents of the copied blocks are from the actual contents in them. If you make a backup of the database without first closing the file, you get a backup image, but it is not useful.

16.3.3 How the File Snapshot Attribute Works

The file snapshot attribute uses block-level copy-on-write technology, a technique of capturing before images of data as it is modified by applications. The primary purpose of these images is to enable point-in-time backups of file systems while they are in use.

Before the file is open, the physical volume contains a file with data that fills multiple storage blocks on the device. The virtual volume contains only metadata about the file. Metadata includes owner, created date/time, and other information about the file and an empty Blocks Changed list.

Whenever the file opens for a Write call, NSS makes a copy of the block’s contents before writing. NSS identifies writes at the block level. The NSS file snapshot attribute updates the metadata for the file, then monitors for writes to the file. When it intercepts a write command, NSS does not immediately write to the physical location. Instead, NSS reads the data in the target block and copies the existing data in that block to the virtual volume. It adds the addresses of the changed blocks to the Blocks Changed list. At this point in the process, the old data exists in two places: the target block and a block in the virtual volume.

Next, NSS allows the new data to overwrite the old data in the target block. Now, the target block contains new data. The file on the physical volume has some blocks that contain old data, and some blocks that contain new data, just as it would after any normal write process. All that is stored in the virtual volume is the metadata about the file and the blocks of data that represent what the file looked like at the moment it was opened (the blocks of data that NSS copied to the virtual volume).

With the file snapshot attribute disabled, your backup software normally cannot capture a file to backup media, if the file is open and changes are in progress. The backup passes over the file and does not copy it to the backup media. The state of the file is not captured to the backup media.

When the file snapshot attribute is enabled and your backup software takes advantage of the feature, the backup knows to read blocks from the virtual volume and from the physical volume for the open file. From the physical volume, the backup software reads the blocks that are as yet unchanged by any block writes. From the virtual volume, the backup software reads the blocks that contain the file’s data as it was when the file opened. The total information saved to the backup media represents the state of the file when the file was opened.

The virtual volume and its contents are not directly accessible to users or non-backup APIs. It is only accessible to Novell Storage Management Services or third-party backup software that takes advantage of the file-snapshot flag. All other applications ignore the virtual volume. If accessing an open file, the backup software reads original data from the virtual volume, but any other application reads the file’s current contents.

When the open file closes, NSS updates the file’s metadata and erases the blocks of original data stored in the virtual volume.

This is how the last-known-good version of the file gets saved to the backup media when it would have been passed over previously. The backup media contains real data; it does not back up the virtual volume per se. It only copies data from the virtual volume to re-create the complete last-known-good copy of the open file.

16.3.4 Sizing the Volume to Accommodate File Snapshots

Initially, the virtual volume occupies very little storage space. It contains only an empty changed-block list. As an application opens a file to update its data, NSS dynamically allocates space in the virtual volume where it can copy blocks of the original data. As blocks of data change, NSS copies the original data to the virtual volume and updates the changed-block list to indicate which blocks have changed.

The size of the virtual volume depends on several factors:

  • The size of the original file when it is opened

  • How the files are used (such as how often they change, when they change, and who changes them)

  • How many blocks of data that a single change affects (up to the number of blocks in the original file)

  • How the application saves changes (such as by blocks or by the entire file)

It is a good idea to set the physical volume’s size to grow dynamically to the size of the pool. Otherwise, you must periodically monitor the volume size to make sure it can accommodate the peak size of the virtual volume as the volume contents fluctuate at peak productivity times. Make sure your volume’s size can also accommodate any seasonal productivity peaks.

16.3.5 Assessing I/O Overhead for File Snapshots

The amount of I/O overhead related to the dynamic file snapshots depends on the usage of the volume. Every time a file opens for write (not read), NSS makes a copy of the metadata about the file, but not the data itself. NSS makes a copy of only that part of the data in the file that a write changes. The algorithm is optimized in such a way that NSS does not make copies of data too often, given the behavior of most applications such as word processors.

Applications write data in different ways. Some close the file after each write, while others close the file intermittently and on demand. As soon as the application closes the file, even if the file is still open for read or for another write, NSS erases any related blocks for that file that are saved in the virtual volume. On executing the next open for write, the process begins again for the file, working with the last closed copy of the file.

Other applications write only differential data at the (logical) end of the file, leaving the existing data blocks intact. In this case, no existing data blocks are overwritten by the application, and there is no writing of data (only metadata) to the virtual volume.

However, in all cases, the backup software can still back up the last closed version of the file.

The thing to remember in assessing overhead is that every time a file is closed, NSS erases its metadata and the original data blocks that were copied to the virtual volume. The data in the virtual volume is not a perpetual copy that is constantly updated.

To assess overhead related to the File Snapshot attribute of an NSS volume:

  • What types of applications are in use? How do those applications write to files? How are closes executed?

  • How many files are there in the volume, categorized by application?

  • How frequently are files changed? Does the frequency change by user or user group? Time of year? Type of application?

  • How much data in the file changes typically with each use? How often are files opened for Read versus for Write?

16.3.6 Configuring Volumes with the File Snapshot Attribute

File snapshots apply only to volumes. You must configure a volume with this attribute in order to take advantage of the feature. After the attribute is set, the file-snapshot process is automatic.

You can set the file snapshot attribute for a volume as you create the volume, or you can opt to set the attribute later.

Setting the File Snapshot Attribute for a New Volume

To enable the file snapshot attribute when you first create the volume:

  1. Open the New Volume wizard in iManager, following the normal setup. See Managing NSS Volumes.

  2. On the Attributes page in the New Volumes wizard, also select the Snapshot - File Level check box.

  3. Complete the New Volume wizard.

    Whenever the volume is first activated, NSS creates the virtual volume and the file snapshot process occurs automatically.

Setting the File Snapshot Attribute for an Existing Volume

To set up the file snapshot attribute after a volume is in use requires some pre-planning. Because you must deactivate and activate the volume to allow NSS to set up the virtual volume, you should initiate the file snapshot attribute at a time when no I/O operations are in progress and all cached data is also reflected in the storage media. For example, to make sure no transactions are lost:

  • Allow in-progress transactions to complete gracefully.

  • Temporarily block any new transactions.

  • Flush any file changes that are cached in memory to the volume.

To enable the file snapshot attribute on a given volume:

  1. Launch a Web browser.

  2. Click File>Open, then enter

    http://svrname.your-company-name.com/iManager.html
    

    Replace svrname with the actual server host name. Replace your-company-name.com with your company’s actual domain name. You can use the server’s IP address (such as 192.168.1.1) instead.

  3. In iManager, log in to the server context that the server belongs to.

  4. In Roles and Tasks, select Storage>Volumes.

  5. Use one of these methods to select a server in the tree where you are logged in:

    • Type the Novell eDirectory server object name for the server you want to manage, then click Apply. For example: svr1.novell.

    • Click the Search icon to open the eDirectory Object Selector. Browse or search the list to locate the server object of the server you want to manage, then click the server name.

    • Click the Object History icon to select a server you have recently managed.

    After iManager connects to the server, the Volumes field lists all of the volumes for the selected server. Let the page load completely before proceeding to the next step.

  6. Select a volume in the Volumes list.

  7. (Conditional) Review the Details area to make sure the volume is active and mounted. If it is not, click Mount.

    The Mount command activates and mounts the volume in one step. The volume should still be selected when the page reloads. If it is not, select the volume again.

  8. Click Properties>Attributes.

  9. Select the Snapshot - File Level check box.

  10. Click Apply.

  11. Click OK.

    This should return you to Volumes page. If not, select Storage>Volumes.

  12. Make sure the volume is selected, then click Deactivate.

    You must deactivate and activate the volume to enable NSS to set up the virtual volume area where file snapshots are stored.

    When the page reloads, the volume is in a deactive state.

  13. If not already selected, select the volume, then click Activate.

    NSS creates the metadata about files in the virtual volume during the activation process. When the page reloads, the volume is in the activated state and the virtual volume is ready for file-snapshot process.

Using Console Commands to Configure the File Snapshot Attribute

To enable the File Snapshot Attribute for one or multiple volumes, enter the following at the server console:

nss /FileCopyOnWrite= VolName

or

nss /FileCopyOnWrite=all

To disable File Snapshot, enter the following at the server console:

nss /NoFileCopyOnWrite

After you set up File Snapshot on your volume, deactivate the volume, then activate the volumes again. This ensures that there are no open files without a snapshot.

16.3.7 Configuring Backup Software to Use File Snapshots

NSS sets a flag that Novell Storage Management Services™ (SMS) and some third-party backup software can read to determine if there are copies of open files available to be backed up.

IMPORTANT:Even if you set this flag, not all third-party backup software takes advantage of the service.

Novell SMS automatically checks for the File Snapshot attribute when it backs up a volume. If the attribute is set, it takes advantage of the feature.

To open a snapshot file for backup, set a bit in the requested rights parameter and set the READ_ACCESS_BIT. This bit is 0x04000000. It is defined in the NSS header files as zPR_READ_ACCESS_TO_SNAPSHOT.

The default setting for File Snapshot is whenever your file system receives an open for write request, it will wait for the backup open to close the file. To return an error, the backup open should also set the deny-the-write bit.

To get information on a snapshot file, use the getInfo command. NSS supports any getInfo call that returns packed information with the RNewStyle bit set in the info mask. You need to set an additional bit 0x20000000 in the information mask. This bit is defined at RNSSInfoOnSnapshot in NSS header files. Both open and getInfo calls require the bit for requested rights and the bit for additional info mask.

The following calls also return information about File Snapshot:

  • GetFileSize

  • GetFileHoles

16.3.8 Restoring Volumes from Backup Media

Whenever backup software tries to read an open file, it reads data from the virtual volume and the volume. The virtual volume contains a list of changed blocks for the file. It reads the original data for those blocks from the virtual volume. Then, it reads the other blocks of data from the volume itself. The data saved to backup media is the file’s original content before it was open.

When you restore the volume from its backup media, it restores just as it does normally. It requires no special action.