> Hi,
>
> We are currently in the process of deactivating a file-server here that
> houses several RW copies of volumes. We want to move these RW volumes
> to another server.
>
I use the following script to move volumes from one partition to another. It
works quite fine BUT I TAKE NO RESPONSIBILITY FOR ANY DAMAGE!
It looks for RO and BK volumes at the source side and restores them at the
destination side, too. Therefore the volume move is done on all "depending"
volumes, not just the original RW volume.
Till
,,,
(o o)
- -----------oOO--(_)--OOo-------------------------------------------
| Tilmann Bubeck | _||__ |
| Universitaet Tuebingen | / . | <- Berlin |
| Technische Informatik | | _/ |
| Sand 13, 72076 Tuebingen | |_ \ |
| Germany | /*__/ <- University of T"ubingen |
|------------------------------------------------------------------
| Tel: +49 7071 295865 Fax: +49 7071 610399 |
| Email: [EMAIL PROTECTED] |
| WWW/Mosaic: http://www-ti.informatik.uni-tuebingen.de/~bubeck |
- -------------------------------------------------------------------
#!/bin/tcsh -f
#
# vos-move [-v] volume-name toserver topart
#
# Move an AFS volume to a new position and copy all corresponding RO's
# and BK's volumes, too.
#
# author: Till Bubeck ([EMAIL PROTECTED])
#
#
# history:
# ----------------------------------
# 02.08.1995 bubeck initial revision
# 08.11.1995 bubeck removed parameter fromserver and frompart
# set either of this two for debugging purposes:
#set debug = echo
set debug
if ( $#argv != 3 && $#argv != 4 ) then
echo "usage: vos-move [-v] volume-name toserver topart"
exit 1
endif
set verb
if ( $argv[1] == "-v" ) then
set verb = "-v"
shift
endif
set volume = $argv[1]
set toserver = $argv[2]
set topart = $argv[3]
vos examine $volume >& /dev/null
if ( $status != 0 ) then
echo "Error: Volume $volume does not exist."
exit 1
endif
# Search for RW-Volume server:
set fromserver = `vos examine $volume | grep "RW Site" | awk '{print $2}'`
set frompart = `vos examine $volume | grep "RW Site" | awk '{print $4}'`
# Check, if this volume is on the fromserver/part:
set found = 0
set ro = 0
set bk = 0
set servervols = `vos listvol $fromserver $frompart | awk '{print $1}'`
foreach vol ($servervols)
if ( $vol == $volume ) set found = 1
if ( $vol == $volume.readonly ) set ro = 1
if ( $vol == $volume.backup ) set bk = 1
end
if ( ! $found ) then
echo "Volume $volume does not reside on server $fromserver partition
$frompart."
exit 1
endif
set frompartShort = `echo $frompart | awk '{print substr($1,length($1),1)}'`
set topartShort = `echo $topart | awk '{print substr($1,length($1),1)}'`
# Are source and destination equal?
if ( $fromserver == $toserver && $frompartShort == $topartShort ) then
echo "RW volume is already there, nothing to move."
exit 0
endif
if ( $bk ) then
if ( $verb == "-v" ) echo vos remove $fromserver $frompart $volume.backup
$debug vos remove $fromserver $frompart $volume.backup
if ( $status ) exit 1
endif
if ( $verb == "-v" ) echo vos move $volume $fromserver $frompart $toserver
$topart
$debug vos move $volume $fromserver $frompart $toserver $topart
if ( $status ) exit 1
if ( $ro ) then
if ( $fromserver == $toserver ) then
# Multiple ROs on a single server aren't allowed.
# Therefore delete old RO first
if ( $verb == "-v" ) echo vos remove $fromserver $frompart $volume.readonly
$debug vos remove $fromserver $frompart $volume.readonly
if ( $status ) exit 1
if ( $verb == "-v" ) echo vos addsite $toserver $topart $volume
$debug vos addsite $toserver $topart $volume
if ( $status ) exit 1
if ( $verb == "-v" ) echo vos release $volume
$debug vos release $volume
if ( $status ) exit 1
else
# Delete all RO on all partitions of the toserver:
set partition = `vos listpart $toserver | grep vicep`
foreach part ($partition)
set vols = `vos listvol $toserver $part | grep $volume.readonly`
if ( $#vols > 0 ) then
$debug vos remove $toserver $part $volume.readonly
break
endif
end
# Add new readonly replica at the new partition
if ( $verb == "-v" ) echo vos addsite $toserver $topart $volume
$debug vos addsite $toserver $topart $volume
if ( $status ) exit 1
# Release the volume
if ( $verb == "-v" ) echo vos release $volume
$debug vos release $volume
if ( $status ) exit 1
# ... and then delete old replica
if ( $verb == "-v" ) echo vos remove $fromserver $frompart $volume.readonly
$debug vos remove $fromserver $frompart $volume.readonly
if ( $status ) exit 1
endif
endif
if ( $bk ) then
if ( $verb == "-v" ) echo vos backup $volume
$debug vos backup $volume
if ( $status ) exit 1
endif
exit 0