Moving AFS Volumes by Name
I help maintain a fairly large OpenAFS installation. One of the things I find myself doing often is moving AFS Volumes from server to server. The command to do so requires you know exactly where the volume currently is before it can be moved to a new server. There’s a reason for that even if AFS already knows where that volume is. In any case, while moving one type of volumes to server A and a different type to server B I decided I needed a tool to make this easier.
Cue the perl-AFS modules and a bit of perl code. I wrote the attached script that will locate the volumes for you and move them to your stated destination. You can do things like:
$ perl move_volumes_by_name.pl -t server00.example.com \
-P /vicepa -c example.com volume1 volume2 volume3 ...
That will move the three volumes given on the command line to server00. Or, you can use some command line redirection and do something like:
$ echo "volume1 volume2 volume3" | perl move_volumes_by_name.pl \
-t server00.example.com -P /vicepa -c example.com -
Use the -d switch (for debug) to see a list of actions that the script would perform without actually performing them.