Setting and Displaying Volume Quota and Current Size

Every AFS volume has an associated quota which limits the volume's size. The default quota for a newly created volume is 5,000 kilobyte blocks (slightly less that 5 MB). When a volume reaches its quota, the File Server rejects attempts to create new files or directories in it. If an application is writing data into an existing file in a full volume, the File Server allows a defined overage (by default, 1 MB). (You can use the fileserver command's -spare or -pctspare argument to change the default overage; see the command's reference page in the OpenAFS Administration Reference.)

To set a quota other than 5000 KB as you create a volume, include the -maxquota argument to the vos create command, as described in Creating Read/write Volumes. To modify an existing volume's quota, issue either the fs setquota or the fs setvol command as described in the following instructions. Do not set an existing volume's quota lower than its current size.

In general, smaller volumes are easier to administer than larger ones. If you need to move volumes, say for load-balancing purposes, it is easier to find enough free space on other partitions for small volumes. Move operations complete more quickly for small volumes, reducing the potential for outages or other errors to interrupt the move. AFS supports a maximum volume size, which can vary for different AFS releases; see the OpenAFS Release Notes for the version you are using. Also, the size of a partition or logical places an absolute limit on volume size, because a volume cannot span multiple partitions or logical volumes.

It is generally safe to overpack partitions by putting more volumes on them than can actually fit if all the volumes reach their maximum quota. However, only experience determines to what degree overpacking works in your cell. It depends on what kind of quota you assign to volumes (particularly user volumes, which are more likely than system volumes to grow unpredictably) and how much information people generate and store in comparison to their quota.

There are several commands that display a volume's quota, as described in the following instructions. They differ in how much related information they produce.

To set quota for a single volume

  1. Verify that you belong to the system:administrators group. If necessary, issue the pts membership command, which is fully described in To display the members of the system:administrators group.

       % pts membership system:administrators
    
  2. Issue the fs setquota command to set the volume's maximum quota.

       % fs setquota [<dir/file path>] -max <max quota in kbytes>
    

    where

    sq

    Is an acceptable alias for setquota.

    dir/file path

    Names a file or directory in the volume for which to set the indicated quota. Partial pathnames are interpreted relative to the current working directory, which is the default if you omit this argument.

    Specify the read/write path to the file or directory, to avoid the failure that results when you attempt to change a read-only volume. By convention, you indicate the read/write path by placing a period before the cell name at the pathname's second level (for example, /afs/.example.com). For further discussion of the concept of read/write and read-only paths through the filespace, see The Rules of Mount Point Traversal.

    max quota in kbytes

    Sets the volume's quota, expressed in kilobyte blocks ( 1024 equals a megabyte). A value of 0 grants an unlimited quota, but the size of the partition imposes an absolute limit. You must include the -max switch if omitting the dir/file path argument (to set the quota on the volume that houses the current working directory).

To set maximum quota on one or more volumes

  1. Verify that you belong to the system:administrators group. If necessary, issue the pts membership command, which is fully described in To display the members of the system:administrators group.

       % pts membership system:administrators
    
  2. Issue the fs setvol command to set the quota on one or more volumes.

       % fs setvol [<dir/file path>+] -max <disk space quota in 1K units>
    

    where

    sv

    Is an acceptable alias for setvol.

    dir/file path

    Names one file or directory that resides in each volume for which to set the indicated quota. Partial pathnames are interpreted relative to the current working directory, which is the default if you omit this argument.

    disk space quota in 1K units

    Sets the maximum quota on each volume, expressed in kilobytes blocks ( 1024 equals a megabyte). A value of 0 grants an unlimited quota, but the size of the partition does impose an absolute limit.

To display percent quota used

  1. Issue the fs quota command.

       % fs quota [<dir/file path>+]
    

    where

    q

    Is the shortest acceptable abbreviation of quota.

    dir/file path

    Names a directory or file in each volume for which to display percent quota used. Partial pathnames are interpreted relative to the current working directory, which is the default if you omit this argument.

The following example illustrates the output produced by this command:

   % fs quota /afs/example.com/usr/terry
   34% of quota used.

To display quota, current size, and other information

  1. Issue the fs listquota command.

       % fs listquota [<dir/file path>+]
    

    where

    lq

    Is an alias for listquota.

    dir/file path

    Names a directory or file in each volume for which to display quota along with volume name and current space usage. Partial pathnames are interpreted relative to the current working directory, which is the default if you omit this argument.

As illustrated in the following example, the output reports the volume's name, its quota and current size (both in kilobyte units), the percent quota used, and the percentage of space on the volume's host partition that is used.

   % fs listquota /afs/example.com/usr/terry
   Volume Name     Quota    Used    % Used   Partition
   user.terry      15000    5071       34%         86%

To display quota, current size, and more partition information

  1. Issue the fs examine command.

       % fs examine [<dir/file path>+]
    

    where

    exa

    Is the shortest acceptable abbreviation of examine.

    dir/file path

    Names a directory or file in each volume for which to display quota information and information about the host partition. Partial pathnames are interpreted relative to the current working directory, which is the default if you omit this argument.

As illustrated in the following example, the output displays the volume's volume ID number and name, its quota and current size (both in kilobyte units), and the free and total number of kilobyte blocks on the volume's host partition.

   % fs examine /afs/example.com/usr/terry
   Volume status for vid = 50489902 named user.terry
   Current maximum quota is 15000
   Current blocks used are 5073
   The partition has 46383 blocks available out of 333305

Note

The partition-related statistics in this command's output do not always agree with the corresponding values in the output of the standard UNIX df command. The statistics reported by this command can be up to five minutes old, because the Cache Manager polls the File Server for partition information at that frequency. Also, on some operating systems, the df command's report of partition size includes reserved space not included in this command's calculation, and so is likely to be about 10% larger.