Creating Backup Volumes

A backup volume is a clone that resides at the same site as its read/write source (to review the concept of cloning, see About Clones and Cloning). Creating a backup version of a volume has two purposes:

Backing Up Multiple Volumes at Once

The vos backupsys command creates a backup version of many read/write volumes at once. This command is useful when preparing for large-scale backups to tape using the AFS Backup System.

To clone every read/write volume listed in the VLDB, omit all of the command's options. Otherwise, combine the command's options to clone various groups of volumes. The options use one of two basic criteria to select volumes: location (the -server and -partition arguments) or presence in the volume name of one of a set of specified character strings (the -prefix, -exclude, and -xprefix options).

To clone only volumes that reside on one file server machine, include the -server argument. To clone only volumes that reside on one partition, combine the -server and -partition arguments. The -partition argument can also be used alone to clone volumes that reside on the indicated partition on every file server machine. These arguments can be combined with those that select volumes based on their names.

Combine the -prefix, -exclude, and -xprefix options (with or without the -server and -partition arguments) in the indicated ways to select volumes based on character strings contained in their names:

  • To clone every read/write volume at the specified location whose name includes one of a set of specified character strings (for example, begins with user. or includes the string afs), use the -prefix argument or combine the -xprefix and -exclude options.

  • To clone every read/write volume at the specified location except those whose name includes one of a set of specified character strings, use the -xprefix argument or combine the -prefix and -exclude options.

  • To clone every read/write volume at the specified location whose name includes one of one of a set of specified character strings, except those whose names include one of a different set of specified character strings, combine the -prefix and -xprefix arguments. The command creates a list of all volumes that match the -prefix argument and then removes from the list the volumes that match the -xprefix argument. For effective results, the strings specified by the -xprefix argument must designate a subset of the volumes specified by the -prefix argument.

    If the -exclude flag is combined with the -prefix and -xprefix arguments, the command creates a list of all volumes that do not match the -prefix argument and then adds to the list any volumes that match the -xprefix argument. As when the -exclude flag is not used, the result is effective only if the strings specified by the -xprefix argument designate a subset of the volumes specified by the -prefix argument.

The -prefix and -xprefix arguments both accept multiple values, which can be used to define disjoint groups of volumes. Each value can be one of two types:

  1. A simple character string, which matches volumes whose name begin with the string. All characters are interpreted literally (that is, characters that potentially have special meaning to the command shell, such as the period, have only their literal meaning).

  2. A regular expression, which matches volumes whose names contain the expressions. Place a caret ( ^) at the beginning of the expression, and enclose the entire string in single quotes ( ' '). Explaining regular expressions is outside the scope of this reference page; see the UNIX manual page for regexp(5) or (for a brief introduction) Defining and Displaying Volume Sets and Volume Entries. As an example, the following expression matches volumes that have the string aix anywhere in their names:

      -prefix '^.*aix'
              

To display a list of the volumes to be cloned, without actually cloning them, include the -dryrun flag. To display a statement that summarizes the criteria being used to select volume, include the -verbose flag.

To back up a single volume, use the vos backup command, which employs a more streamlined technique for finding a single volume.

Automating Creation of Backup Volumes

Most cells find that it is best to make a new backup version of relevant volumes each day. It is best to create the backup versions at a time when usage is low, because the backup operation causes the read/write volume to be unavailable momentarily.

You can either issue the necessary the vos backupsys or vos backup commands at the console or create a cron entry in the BosConfig file on a file server machine, which eliminates the need for an administrator to initiate the backup operation.

The following example command creates a cron process called backupusers in the /usr/afs/local/BosConfig file on the machine fs3.example.com. The process runs every day at 1:00 a.m. to create a backup version of every volume in the cell whose name starts with the string user. The -localauth flag enables the process to invoke the privileged vos backupsys command while unauthenticated. Note that the -cmd argument specifies a complete pathname for the vos binary, because the PATH environment variable for the BOS Server (running as the local superuser root) generally does not include the path to AFS binaries.

   % bos create fs3.example.com backupusers cron\ 
  -cmd "/usr/afs/bin/vos backupsys -prefix user -localauth" "1:00"

Making the Contents of Backup Volumes Available to Users

As noted, a backup volume preserves the state of the read/write source at the time the backup is created. Many cells choose to mount backup volumes so that users can access and restore data they have accidentally deleted or changed since the last backup was made, without having to request help from administrators. The most sensible place to mount the backup version of a user volume is at a subdirectory of the user's home directory. Suitable names for this directory include OldFiles and Backup. The subdirectory looks just like the user's own home directory as it was at the time the backup was created, with all files and subdirectories in the same relative positions.

If you do create and mount backup volumes for your users, inform users of their existence. The OpenAFS User Guide does not mention backup volumes because making them available to users is optional. Explain to users how often you make a new backup, so they know what they can recover. Remind them also that the data in their backup volume cannot change; however, they can use the standard UNIX cp command to copy it into their home volume and modify it there. Reassure users that the data in their backup volumes does not count against their read/write volume quota.

To create and mount a backup volume

  1. Verify that you are listed in the /usr/afs/etc/UserList file. If necessary, issue the bos listusers command, which is fully described in To display the users in the UserList file.

       % bos listusers <machine name>
    
  2. Verify that you have the insert( i) and administer( a) permissions on the ACL of the directory in which you wish to mount the volume. If necessary, issue the fs listacl command, which is fully described in Displaying ACLs.

       % fs listacl [<dir/file path>]
    

    Members of the system:administrators group always implicitly have the a( administer) and by default also the l( lookup) permission on every ACL and can use the fs setacl command to grant other rights as necessary.

  3. Issue the vos backup command to create a backup version of a read/write source volume. The message shown confirms the success of the backup operation.

       % vos backup <volume name or ID> Created backup volume for volume name or ID
    

    where

    backup

    Must be typed in full.

    volume name or ID

    Identifies the read/write volume to back up, either by its complete name or volume ID number. The backup volume has the same name with the addition of the .backup extension. It has its own volume ID number.

  4. (Optional) Issue the fs mkmount to mount the backup volume. While this step is optional, Cache Managers cannot access the volume's contents if it is not mounted.

       % fs mkmount <directory> <volume name> .backup
    

    where

    mk

    Is the shortest acceptable abbreviation of mkmount.

    directory

    Names the mount point to create. Do not create a file or directory of the same name beforehand. Partial pathnames are interpreted relative to the current working directory. For the backup version of a user volume, the conventional location is the user's home directory.

    volume name.backup

    Is the full name of the backup volume.

  5. (Optional) Issue the fs lsmount command to verify that the mount point refers to the correct volume. Complete instructions appear in To display a mount point.

       % fs lsmount <directory>
    

To create multiple backup volumes at once

  1. Verify that you are listed in the /usr/afs/etc/UserList file. If necessary, issue the bos listusers command, which is fully described in To display the users in the UserList file.

       % bos listusers <machine name>
    
  2. Issue the vos backupsys command to create a backup version of every read/write volume that shares the same prefix or site. The effects of combining the three arguments are described in Backing Up Multiple Volumes at Once.

       % vos backupsys [-prefix <common prefix on volume(s)>+] \ 
            [-server <machine name>] [-partition <partition name>] \
            [-exclude] [-xprefix <negative prefix on volume(s)>+] \
            [-dryrun] [-verbose]
    

    where

    backups

    Is the shortest acceptable abbreviation of backupsys.

    -prefix

    Specifies one or more simple character strings or regular expressions of any length; a volume whose name includes the string is placed on the list of volumes to be cloned. Include field separators (such as periods) if appropriate. This argument can be combined with any combination of the -server, -partition, -exclude, and -xprefix options.

    -server

    Specifies the file server machine housing the volumes to backup. Can be combined with any combination of the -prefix, -partition, -exclude, and -xprefix options.

    -partition

    Specifies the partition housing the volumes you wish to backup. Can be combined with any combination of the -prefix, -server, -exclude, and -xprefix options.

    -exclude

    Indicates that all volumes except those indicated with the -prefix argument are to be backed up. The -prefix argument must be provided along with this one. Can also be combined with any combination of the -prefix, -server, and -partition arguments; or with both the -prefix and -xprefix arguments, but not with the -xprefix argument alone.

    -xprefix

    Specifies one or more simple character strings or regular expressions of any length; a volume whose name does not include the string is placed on the list of volumes to be cloned. Can be combined with any combination of the -prefix, -server, and -partition arguments; in addition, it can be combined with both the -prefix and -exclude options, but not with the -exclude flag alone.

    -dryrun

    Displays on the standard output stream a list of the volumes to be cloned, without actually cloning them.

    -verbose

    Displays on the standard output stream a statement that summarizes the criteria being used to select volumes, if combined with the -dryrun flag; otherwise, traces the cloning operation for each volume.