Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] rsync v. cp in data migration



This is the script I ended up using: (in color: http://pastebin.com/une2RYq2
)

Because the SOURCE wasn't NFS mounting, I ended up adding back in the -z to
rsync and the network portion is over SSH rather than NFS.

642GB have been copied so far.  18 of 149 users are complete and everything
looks good.

cat /root/bin/copy.home.dirs.sh
#!/bin/bash -e
# run bash with -e to exit on errors

# create a function that we can attach a signal to
# in case we want to stop this script
# otherwise if we press Ctrl-C, it will just continue
# with the next iteration in the loop
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
# now set the trap
trap cleanup SIGINT SIGTERM
SOURCE=a.example.com
LOGFILE=home.copy.log

# we will use a prepared file 'users' whose contents are a list of users,
one user per line
while read USER
do echo "Working on $USER" | tee -a $LOGFILE
TIMING="$(time ( rsync -avSHPz root@$SOURCE:/home/$USER/ /nas_home/$USER/ )
2>&1 1>/dev/null )"
echo $TIMING | tee -a $LOGFILE
echo "/home/$USER copied to new NAS" | tee -a $LOGFILE
echo "" | tee -a $LOGFILE
done < "users"

Greg Rundlett



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org