AFS Volumes

Information on AFS volumes and mount points

Reviewed by John Sopko 6/17/2014

This is one of several AFS help pages.  To get started with AFS see the AFS Introduction. Click on the AFS tag above to list all AFS related help pages.

Linux divides disks into physical disk partitions.  AFS further divides partitions into objects called volumes.  Linux partitions are containers for AFS volume objects.  A volume houses a subtree of related files and directories.  Normally, volumes are smaller than traditional file systems.  For example, each user’s home directory would normally be stored in a separate volume.  Each major sub-directory of /afs/cs.unc.edu/project and /afs/cs.unc.edu/pkg would also be stored in a separate volume. Large sub-directories are further sub-divided.

AFS keeps a database of which file servers have which volumes. AFS automatically determines which file server to get files from.  You do not need to know which file server houses any volume.  Indeed, it may move during its lifetime. If you wish to know on which file server a file is currently stored, you can use the command “fs whereis”:

% fs whereis /afs/unc/home/user1 
 File /afs/unc/home/user1 is on host grouse

Volumes can have a size limit, or quota. Y ou may receive error messages if the volume you are writing into exceeds its quota.  Home directory volumes here at UNC Computer Science Department have different quota levels, depending on the account category.  Other volumes may have quotas as set by research groups.  To see the quota and partition info for a particular directory, you can use the AFS command “fs listquota”, assuming you have sufficient permissions on the directory:

% fs listquota /afs/unc/home/user1 
 Volume Name        Quota    Used    % Used   Partition 
 D0.home.user1     150000    17        0%        41%

Access to volumes is provided through mount points. Mount points appear in the file system as directories.  When you cd into a directory, you may be crossing a mount point and accessing a new volume, which may be stored on a different AFS file server machine.  To see all of the details about mount points, quota, etc. for a given directory, you can use the “fs examine” command.

% fs examine /afs/unc/home/user1 
 Volume status for vid = 536870983 named D0.home.user1 
 Current disk quota is 150000 
 Current blocks used are 17 
 The partition has 78222 blocks available out of 133602

In general you shouldn’t need to worry about volume information, but realizing that underneath the directory structure is a volume structure can be helpful when restoring and moving files. See AFS File Restoration.

Backups of your home directory are made Monday – Friday starting at 2 a.m. A copy of your files is made at that time, and it is accessible to you until the next backup runs. 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.

Backup volumes are accessible at /afs/cs.unc.edu/home/Last_Backup/login.

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/login to your regular home directory.Backup volumes 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. Execute:

% 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/user1/tempmount D0.prj.test1.backup

If you get an error from your command you probably do not have permissions to the volume.  Email help@cs.unc.edu for assistance.

4. If the command succeeds, cd into the name given as the mount  point, and copy the file back into project space. T hen 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 asking for the restoration.

Running out of disk space in AFS

See the disk usage help page on how to determine how much space you are using and controlling your disk usage.

If you run out of space in your AFS home directory or a project directory and you don’t get a message about exceeding your quota, then the problem is that the physical partition has filled up. Computer Services monitors disk usage, so this rarely occurs. Your home directory volume is in a physical partition with other volumes. Please email help@cs.unc.edu about this issue.

You can delete any file you have created that day. That space will be reclaimed and be immediately available. Deleting older files will reclaim space after the next backup runs. For an explanation of why this is, please see How AFS backup volumes work below. Don’t let this dissuade you from deleting old files; you’ll appreciate it tomorrow.

If you need assistance email help@cs.unc.edu.

How AFS backup volumes work

Volumes whose names end in .backup are the copies that the backup software creates. The AFS backup process locks the volume while the backup is run, so to minimize the loss of access, these backup volumes are created early in the morning and the backup software backs them up instead of the original volume.

Backup volumes are identical to the original volume when they are created.  Over the course of the day, they get further away from the original, as the owner modifies files.  When created, they actually occupy very little space, just the amount needed to point to the same data blocks that the original does.  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 for reuse.  But when an AFS backup volume exists, that block can’t be freed because there is still a valid reference to it.  So 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.

From this discussion, you can see that the way you use your disk space will affect how much space you have through the day. If, as a matter of course, you throw away a 200 MB directory and copy it over from elsewhere every day, you are effectively occupying 400 MB within that space, 200 for the old one (pointed to by the backup volume), and 200 MB for the new copy. This type of usage can cause significant inconvenience to the others who share your AFS partition.

Finding which file server holds your files

With AFS, it is not obvious which file server actually holds your volume.  The quick way to find what AFS server holds your files is to cd to
the directory in question and execute the “fs whereis” command:

% fs whereis
File . is on host waxwing.cs.unc.edu

To find out what the volume name and partition a volume resides on:

First get the volume name, cd to the directory in question and execut the “fs exam” command:

% pwd
/afs/cs.unc.edu/project/mip
% fs exam .
Volume status for vid = 536878268 named T0.prj.mip
Current disk quota is 2000000
Current blocks used are 25
The partition has 298726 blocks available out of 7615957

Then use the “vos” command to get server and partition info:

% vos exam T0.prj.mip
T0.prj.mip                        536878268 RW         25 K  On-line
 falcon.cs.unc.edu /vicepd 
 RWrite  536878268 ROnly          0 Backup  536878270 
 MaxQuota    2000000 K 
 Creation    Wed Sep  8 07:06:02 1993
 Last Update Fri Jun 14 12:01:36 2002
 556 accesses in the past day (i.e., vnode references)
RWrite: 536878268     Backup: 536878270 
 number of sites -> 1
 server falcon.cs.unc.edu partition /vicepd RW Site
The volume T0.prj.mip resides on the server waxwing partition /vicepd.