University Computing Systems
Synchronizing AFS Home Directory to Local Disk
The procedure described here gives faculty members access to a recent
version of their AFS home directory when, due to some system problem, that
directory is not available. A user may also opt for a
local login.
-
If a user maintains a local (non-AFS) home directory on their workstation,
the user may wish to synchronize their AFS home directory with their
local home directory.
-
Alternatively, the user may wish to have a recent copy of their AFS home directory
available in some arbitrary local directory on their workstation.
The following utility is available for such a purpose :
/usr/ucs/bin/rsync.afs.sh
rsync.afs.sh takes both a SOURCE and a TARGET
directory on the command line and uses the
rsync program to perform
its operations.
Example of Usage :
rsync.afs.sh -s /afs/cad/u/j/j/jjones -t /export/home/jjones
The above command copies AFS home directory (SOURCE) for user jjones to
/export/home/jjones (TARGET). After the above has been run for the first
time, any subsequent runs will copy only the changes made in the SOURCE to
the TARGET since the last time rsync.afs.sh was run.
Note:
- If there are files located in the TARGET
directory that do not exist or differ from files in the SOURCE directory,
those files in TARGET will be removed or overwritten. To preserve
files in the TARGET, files located there that will be removed or
overwritten should be copied to another location before running
rsync.afs.sh.
-
If there may be insufficient local disk space for the copy operation,
it is desirable to run rsync.afs.sh with the -c option, which
will "Calculate" the amount of disk space needed on the TARGET. The
needed space is calculated based on the amount of space occupied by
the SOURCE. If there isn’t enough space available on the
TARGET, the copy process will not begin.
Normally, this option is best used when invoking rsync.afs.sh for the first
time to get an idea of how much local disk space will be needed.
Scheduling via cron :
rsync.afs.sh may be run on a regular basis by scheduling it to run through cron.
To schedule a daily cronjob, use the -c option :
rsync.afs.sh -s /afs/cad/u/j/j/jjones -t /export/home/jjones -c
The above will install the above command into the user’s crontab and
will run daily at 2:45 am (that time is hard-coded into rsync.afs.sh).
Caveats re: cron
-
When rsync.afs.sh is invoked through cron, rsync.afs.sh will need to be
running with the user’s AFS token in order to read the contents of the
user’s AFS home directory. If the user is logged into hi/her
workstation, and has their AFS token, rsync.afs.sh will also have that token
when it runs, and thus can read the contents of the user's home directory.
However, if the user has logged out of their workstation, or has otherwise
lost his/her token, there will be no token available. rsync.afs.sh will
detect this situation, and will exit without doing anything.
For questions regarding the use of rsync.afs.sh, or to request additional
features, please contact sys@oak.njit.edu.