University Computing Systems


Synchronizing AFS home directory to local disk


If a user maintains a local login (home) directory on their workstation, they may wish to synchronize their AFS home directory with their local home directory.

The following utility is available for such a purpose :

	/usr/ucs/bin/rsync.afs.sh
	

The above utility takes both a SOURCE and a TARGET directory and uses the rsync program to perform its operations.

Examples of Usage :

	rsync.afs.sh -S /afs/cad/u/j/j/jjones -T /export/home/jjones
	

The above 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 only copy the changes made in the SOURCE to the TARGET since the last time it was run.

Note: If a user already has files located in the TARGET directory that do not exist or differ from files in the SOURCE, those existing files will be removed or overwritten. To preserve any existing files in the TARGET, exisiting files should be copied to another location before running the above.

If there is a shortage of local disk space, it may be desirable to run the utility with the -C option which will "Calculate" the amount of disk space needed on the target. The needed space is calcuated 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.

The script 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.

caveats:
When rsync.afs.sh is invoked through cron, it 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 a user always stays logged into his/her machine, this should not be a problem. However, if one logs out of their machine on a regular basis, rsync.afs.sh will not be run with the user’s AFS token when the user is logged out.