[CentOS] Re: rsync and swapping

Robert

kerplop at sbcglobal.net
Fri Feb 1 04:20:46 UTC 2008



Scott Silva wrote:
> on 1/30/2008 5:24 AM Jerry Geis spake the following:
>> hi all,
>>
>> I use rsync to copy/backup ALL my stuff to another disk.
>>
>> When I run this seems like my machine (4 GIG ram centos 5.1)
>> now begins to swap out more programs. Is there a way to reduce
>> that swapping? I am running with echo 1 > /proc/sys/vm/swappiness
>>
>> I simply mount /dev/sdc1 /mnt/backup; mkdir /mnt/backup/month.day.year
>> then rsync -a /home /mnt/backup/mon.day.year
>>
>> This is approximately 102G of data.
>>
>> Thanks for any suggestions.
>>
>> Jerry
> Rsync's main benefit is on backups of changed files. dumping to a new 
> destination every time makes rsync less efficient than just about 
> every other option.
> Now if you made the new directory, and hardlinked the old stuff to the 
> new directory, then rsync would shine.
Yes. That's my experience, too.
I do something like this twice weekly to 2 external USB drives. One 
drive contains backups from the most recent 2 Sunday mornings, the other 
drive contains two backups from Wednesday mornings.
After mounting the backup drive, doing a space-available check and a 
couple other housekeeping chores, I do this.
# (I've purposely left out a bunch of stuff to avoid being blamed when 
someone's system craters. )

$UD  #-- Previously identified as the USB drive mount point
#
DT=`date +%F` #-- Today's date, for naming the backup directory: yyyy-mm-dd
#
# Shuffle directories so that oldest backup directory is renamed to 
today's date.
#
OD=`ls -1 $UD | head -1`
#echo "Renaming $UD/$OD to $UD/$DT"
mv $UD/$OD/ $UD/$DT
touch $UD/$DT

# Now, data that is only 2 weeks old will be overwritten with current data.

for SD in <list of directories to back up> ; do
rsync -ar --exclude '*.iso' --delete-excluded  /$SD/* $UD/$DT/$SD
done

#  I've used the basic outline above since Sept 13, 2006 and have found 
that the backup takes slightly more than half as long as when I used 
"find" and "cpio".  As with anything else, YMMV.





More information about the CentOS mailing list