[1804] in SIPB-AFS-requests
a script for mass movement of volumes
daemon@ATHENA.MIT.EDU (Albert Dvornik)
Mon Feb 20 04:37:46 1995
From: "Albert Dvornik" <bert@MIT.EDU>
To: afsreq@MIT.EDU, sipb-afsreq@MIT.EDU, zone-cell@MIT.EDU
Date: Mon, 20 Feb 1995 04:37:27 EST
So I've written a (hopefully useful) Perl script that deals with
moving all the volumes from a partition or an entire machine onto a
different partition. It lives in /mit/bert/PERL/volmove.pl.
For now, I'm even keeping the creeping features at bay. =)
I realize several other people have scripts which do something similar,
but I think mine has some useful features others don't have.
Matt Braun suggested I send mail to some of the above places...
*** How it works
The scheme works as following. For each read-write volume on the
source partition (or entire server, if no partition was specified), the
following happens:
1) The volume gets moved to the destination partition.
2) If the volume meets criteria for being backed up (usually, if it
was backed up on the old partition; see -b option), it is backed up.
3) If the volume previously had read-only sites on that
partition/server, a RO site is added on the new partition and the
volume is released. (This can be disabled using the -r option.)
4) If the volume previously had read-only sites on that
partition/server, these volumes are removed.
(This can be disabled using the -o option.)
For any additional RO replication sites (which have no RW counterparts
on that machine/server), the following happens:
a) A replication site is added on the new partition and the
volume is released. (This can be disabled using the -r option.)
b) The old replication volumes are removed.
(This can be disabled using the -o option.)
If Ctrl-C is pressed at any point in this process, the move will be
stopped as soon as the vos operation in progress is over. This is
useful if you need to stop the move for some reason (e.g. partition is
about to fill up). I tested it a bunch under Ultrix and Solaris, and
it worked.
Caveat: isolating vos from the Ctrl-C's *should* work on all platforms,
but it was tested only under Ultrix and Solaris. (Even if it failed,
vos now seems to trap the first SIGINT and warn about consequences of
the next one, though "should" and "seems to" make good Famous Last Words.)
*** Design considerations (aka "bugs I don't plan to fix" >;) )
If a volume already has a replication site on any partition of the
destination server, or if source and destination are both on the same
server, creation of a new replication site in 3) or a) will fail.
The error will appear in the logs, but the problem is that this will
get quietly ignored. I currently don't think this is worth fixing.
*** Using it
The script lives in my PERL directory; just doing "add bert" should put
it in your path. The command line format is
volmove.pl [options] from-host[.part] to-host.part [cell [logfile]]
(Just running "volmove.pl" gives you a shorter usage message.)
The options you can currently specify are:
-b If "-b" is not specified, a backup volume will be automatically
created iff a backup volume existed on the old partition.
If "-b" is specified, a backup volume will be automatically
created iff the name doesn't start with "n." nor end in ".nb".
-o Do not remove old read-only volumes. May be useful if you really
want to keep the old RO volumes for some reason, but it usually
means you'll have to blow away the old RO volumes by hand.
Unless you specify -r, the volumes *will* get released anyway.
-r For each RO site on the source partition, do not automatically
add new replication sites on the destination partition and
release the volume. This is probably mostly useful in
conjuction with the -o option.
(-o and -r don't imply each other or anything...)
-v Verbose output. Will print out output of all underlying vos
commands to the terminal (in addition to logging it to a file,
which always happens anyway).
-n Don't do anything, just say what we WOULD do.
-d Debugging output. Probably useful to no one but^H^H^Hincluding me. =)
Giving just the host name, without the partition, for the "from"
location indicates all partitions on that machine. The "to" location
must specify the partition.
Leaving out the "cell" parameter may lead to authenticantion problems
unless the cell is your default cell (aka "athena").
The logfile specifies the file where the output of all the vos
operations will be stored. The default is /usr/tmp/volmove.log.<pid>
(the script will print the filename when it fisishes).
So, if you have comments, suggestions or gripes about this, or want to
kill me because of something it did =), let me know. In fact, I think
I'd like to know if you use it at all...
--bert