AFS Backups

How AFS backups work

Reviewed by John Sopko 6/3/2014

See Introduction to AFS to get started with AFS.

How AFS Backup Volumes Work

AFS backup volumes are created nightly by a program that runs on one of the AFS database servers.  The backup volume’s name is the same as the regular volume, but with “.backup” appended.  For example, the backup volume for D3.home.sopko is D3.home.sopko.backup.  The AFS backup process locks the volume while the backup is run.  To minimize the loss of access, these backup volumes are created very early in the morning, and the backup software copies the backup volume to tape instead of the original volume.

Backup volumes are identical to the original volume when they are created.  Over the course of the day, as the owner modifies files, they get further away from the original.  When created, backup volumes actually occupy very little space–just the amount needed to point to the same data blocks that the original has.  When a user modifies a file in UNIX, the operating system uses a technique called “copy on write.”  The modified blocks are written to a different location.  If the file is outside of AFS, the old block is then freed up for reuse.  When an AFS backup volume exists, however, that block can’t be freed because there is still a valid reference to it.  As files change, the backup volume gradually occupies more space in the partition.  The next night, the two are synchronized, and those blocks are reclaimed.  When you look at a “/usr/afsws/etc/vos listvol” listing, it looks like the backup copies are occupying as much space as the original, but the actual amount will depend on how different the backup and original volumes are.

Our backup system transfers the AFS backup volumes to tape Monday-Friday starting at 3:00 a.m.  These tapes are kept for a period of three months.  Restoration of files can be done by the user on the same day that a file is lost (See Instant File Restoration, below.) or by Computer Services if the user requests assistance by sending email to help@cs.unc.edu.  To restore files, we need the following information:  the complete path to the file(s) lost and a date from which to restore the file(s).

Instant File Restoration

Backup volumes of your home directory are created Monday-Friday in the very early morning.  A copy of your files is made at that time, and it is accessible to you until the next backup runs (usually early the next morning).  This means that if you delete or modify a file that existed at the time of the last backup, you can probably restore this instantly, without sending mail to help@cs.unc.edu.  Backup volumes for home directories are accessible as

/afs/cs.unc.edu/home/Last_Backup/yourlogin

To restore your file, cd into the appropriate Last_Backup directory. You will find your entire directory structure available.  Simply copy the file from its location under Last_Backup/yourlogin to your regular home directory.

Backup volumes also exist for other AFS volumes that receive daily backups.  If you are working in project space, for example, you may be able to get an instant restoration there as well:

1. Make sure you are authenticated to AFS (i.e., use the token command).

2. cd into the directory from which you lost the file and type

% fs exam

This will print information about the volume, such as the name.  Here is sample output:

Volume status for vid = 536873139 named D0.prj.test1
Current disk quota is unlimited
Current blocks used are 119
The partition has 16420 blocks available out of 133602

In this output, the name of the volume is D0.prj.test1.

3. Mount the backup copy of this volume:

% fs mkmount afs_location volume_name.backup

For example:

% fs mkmount /afs/unc/home/yourlogin/tempmount D0.prj.test1.backup

If you get an error from your command, it means the backup volume does not exist, and you have to request the restoration from help.

4. If the command succeeds, cd into the name given as the mount  point, and copy the file back into project space. Then cd out of the backup volume and type

% fs rmmount afs_location

to remove the mount point.

You only have until the next AFS backup runs to do this restoration. After that, the backup will not have the old file.

If you encounter any problems, send mail to help@cs.unc.edu to ask for assistance.