Synchronize AFS Home Directory to Local Disk
Synchronize 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.
- 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.
Note: If, due to a system problem, a user's AFS home directory is not available, logins to a user's workstation may "hang". For this reason, some faculty may want their workstation to be set up so that they log in to a local (non-AFS) home directory. To have this set up, please contact arcs@njit.edu.
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
This 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.
- 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 you run 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 you use rsync.afs.sh for the first time to get an idea of how much local disk space will be needed.
How to schedule via the cron daemon:
rsync.afs.sh may be run on a regular basis by scheduling it to run via the croa daemon. To schedule a daily "cronjob", use the -c option:
rsync.afs.sh -s /afs/cad/u/j/j/jjones -t /export/home/jjones -c
This command 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 with cron:
- When rsync.afs.sh is invoked through cron, rsync.afs.sh will need to run 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 to rsync.afs.sh. 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 arcs@njit.edu.