[OpenAFS] afs cell migration

Steve Simmons scs@umich.edu
Thu, 15 Mar 2007 13:03:44 -0400


--Apple-Mail-5-250013037
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

On Mar 15, 2007, at 9:03 AM, Jose Angel Herrero wrote:

> We have an afs cell (atc.unican.es) installed in a HP Proliand  
> DL380 G3 and Linux (Debian 3.0 r2) server. The afs partitions  
> (vicepxx)  for this cell are located in a HP MSA20 (SATA disk drive  
> storage enclosure with 12 SATA disks with Ultra320 SCSI host  
> connectivity and 6 TB). Now, we want migrate this cell (fileserver  
> and dbserver) from this server to another server and we do not want  
> to lose the data of our cell. We want to change the server  
> (hardware), but no the disk library (vicepxx). We want to conserve   
> the data in this disk library.
>
> So, we would like to know if there is some mechanism from afs admin  
> commands suite that allows us to migrate it.

There's nothing I know of standard in the afs admin commands, but  
here's a little shell script I use for that purpose. It expects as  
input a list of volume/server/partition indicators, one per line:

     user.foo server.do.main a

and will move them to a server/partition pair you set in the script.  
One nice feature of this is that you can make it pause or stop in mid- 
run without having to interrupt anything. Another is that you can set  
it to move 1/n-th of the volumes by resetting "DO=n". Read the script  
for details.

Note: does not attempt to handle readonly volumes.

One of these days Real Soon Now I'll get around to modifying the  
script to automagicly find volumes from a list and to take the target  
fileserver/partition as switches.



--Apple-Mail-5-250013037
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0755;
	name=mvvols
Content-Disposition: attachment;
	filename=mvvols

#!/bin/bash
#
#  Script to move volumes from a list, skipping all but the
#  Nth item in the list.  Thus if one moves every fourth volume
#  (DO=4) one has moved 25% of the volumes from the list.
#
#  Input data should be three items per line: volume name,
#  server and partition where the source volume lives is.
#  It will be moved to the server and partition name listed
#  here as NEWSRV and NEWPART.
#
#  TODO _
#    Take target server and partition name(s) from command
#      line switches, take increment from command line switches.
#    Default partition to 'a' if not listed.
#    Default increment to '1' (do all) if not listed.
#    Allow for input of multiple server/partition lists
#      on command line, spread volumes evenly across them.
#
NEWSRV=afs34.ifs.umich.edu
NEWPART=a
DO=1
CUR=1
STOPNOW="./stopnow"
PAUSENOW="./pausenow"
MOVEDLIST="./vols.moved"
REMAINDER="./not.moved"
VERBOSE=""
VOLS_MOVED=0
VOLS_SKIPPED=0
DATEFMT="+20%y/%m/%d %H:%M:%S"
touch "${REMAINDER}"
touch "${MOVEDLIST}"
STARTED=`date "${DATEFMT}"`
echo $STARTED > start_time

report_result() {
    ENDED=`date "${DATEFMT}"`
    echo "Started at $STARTED, ended $ENDED, moved $VOLS_MOVED volumes, skipped $VOLS_SKIPPED."
    exit
}

while read V S P ; do
    while [ -f "$PAUSENOW" ] ; do
        echo "Sleeping 60 seconds because file '$PAUSENOW' seen."
        sleep 60
    done
    if [ -f "$STOPNOW" ] ; then
	echo "Stop file '$STOPNOW' seen.  Halting."
	report_result
    fi
    if [ "" != "$VERBOSE" ] ; then
	echo Cur is $CUR
    fi
    if [ "$DO" == "$CUR" ] ; then
	CUR=1
        date "${DATEFMT}: Start 'vos move $V $S $P $NEWSRV $NEWPART -localauth'"
        vos move $V $S $P $NEWSRV $NEWPART -localauth
        date "${DATEFMT}: Start 'vos backup $V -localauth'"
	vos backup $V -localauth
        date "${DATEFMT}: End backup of '$V'"
        echo $V $S $P >> "${MOVEDLIST}"
        VOLS_MOVED=`expr $VOLS_MOVED + 1`
    else
        CUR=`expr $CUR + 1`
	if [ "" != "$VERBOSE" ] ; then
	    echo Leaving $V $S $P
	fi
        VOLS_SKIPPED=`expr $VOLS_SKIPPED + 1`
        echo $V $S $P >> "${REMAINDER}"
    fi
    #sleep 2
done
report_result

--Apple-Mail-5-250013037
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed



--Apple-Mail-5-250013037--