- Getting started with Andrew File System and OpenAFS


Become root

All the commands here are done as root. To become root type:

(on Debian type su - instead of sudo -s since sudo is not set up by default):

sudo -s

Syncronize time

Obs: If you already have NTP set up, you may skip this step (check with ps ax | grep ntp[d] ).

As root:

apt-get update
apt-get -y install ntpdate
apt-get -y install ntp

Install OpenAFS

Install the OpenAFS client and other software and compile the kernel modules (building the module may take a few minutes):

apt-get -y  install krb5-user openafs-krb5 openafs-client
  • When you are asked about your cell name look at the documentation from e.g. your IT-department.
  • You are also asked about your AFS cache size. It defaults to 50 MB (50000). It is good practice to set this value higher than the largest single file you are planning to work on. Be aware though that you must have the amount of data free on your local PC for the AFS cache (e.g. a cache size of 50 MB consumes up to 50 MB of your file system).
  • If you are asked about your Default Kerberos version 5 realm enter the cell name (from before) in upper case.

Start OpenAFS

/etc/init.d/openafs-client restart

Test that your OpenAFS client setup is basicly working

Test by accessing a public cell on

cd /afs/

You can now use Eye Of Gnome (eog) to view the logo of OpenAFS:

eog openafs-logo.jpg 

Log in to your home cell

First you log in to Kerberos, and with that you can get an AFS token.


Obtain a TGT (Ticket Granting Ticket) With MIT KRB5:

kinit <username>


kinit john

Check with klist:

$ klist
Credentials cache: API:501:2
        Principal: john@EXAMPLE.ORG

  Issued                Expires               Principal
Feb 25 22:09:07 2013  Feb  26 08:09:07 2013  krbtgt/EXAMPLE.ORG@EXAMPLE.ORG


Get an AFS token


Check with

$ tokens

Tokens held by the Cache Manager:

User's (AFS ID 1000) tokens for [Expires Feb 28 02:50]
   --End of list--

Depending on the lay out of the AFS cell you are using you should now have access to the folder /afs/<cell>/user/<user> e.g. /afs/

Robustness against unstability if filesystem gets filled

It is very bad if the AFS cache runs out of disk space. The example below creates a seperate partiton for the OpenAFS cache, expects a cache size of maximum 500 MB and that the cache manager has not been installed yet (if it has, shut down the cache manager / AFS client and empty the cache directory before creating the mountpoint).

dd if=/dev/zero of=/var/cache/openafs-cache.img bs=1M count=550   # (~550 MB partition)
mkfs.ext4 /var/cache/openafs-cache.img
tune2fs -c 0 -i 0 -m 0 /var/cache/openafs-cache.img
mkdir /var/cache/openafs
echo '/var/cache/openafs-cache.img /var/cache/openafs ext4 defaults,loop 0 2' >> /etc/fstab #Only run this once
mount /var/cache/openafs

Get rid of all the preconfigured cells in /afs

As root:

echo > /etc/openafs/CellServDB # works after next restart of the cache manager / AFS client


If you are using Ubuntu 12.10 (which is missing a patch from Debian AFAIK), this is probably for you:

If after a kernel upgrade (normally it should work out of the box) OpenAFS is not working because you do not have the openafs kernel module (check with lsmod | grep openafs) the following commands should help you on your way:

module-assistant clean openafs-modules 
module-assistant prepare openafs-modules 
module-assistant auto-build openafs-modules
module-assistant auto-install openafs-modules
modprobe openafs
service openafs-client restart
QR Code
QR Code client:linux (generated for current page)