Tuesday, January 17, 2006

Simple Local Rsync Use

Earlier this month I posted how I use rdiff-backup to keep a copy of files on a remote system, along with incremental changes. I also have an external USB/Firewire 2.5 inch hard drive that holds older files. I decided I wanted to copy all of the files from my laptop hard drive that were not present on the external hard drive.

The local data is stored in /data and the external drive is located at /mnt. I keep identical directories on each partition.

orr:/home/richard$ ls /data
Recycled iso misc tmp writing
code lpc test vmware zip
documents media tgz work
orr:/home/richard$ ls /mnt
Recycled iso misc tmp writing
code lpc test vmware zip
documents media tgz work

I decided to use Rsync to get the files not on /mnt from /data to /mnt. In the following example I copy files involving the /data/documents directory.

orr:/data$ rsync -vr /data/documents/* /mnt/documents
building file list ... done
doc/DYNAMIC HOST CONFIGURATION PROTOCOL.doc
doc/Speaker Submission form.doc
doc/bejtlich_proposal_issa-denver_2005.doc
doc/bejtlich_proposal_technosecurity_2006.doc
...edited...
txt/why_CREATE.txt
xls/SCCNS_Chapters.xls
xls/remember.xls

sent 26401643 bytes received 2518 bytes 621274.38 bytes/sec
total size is 190958410 speedup is 7.23

When finished, /mnt/documents has all of the files it originally had, along with the new files found in /data/documents. I like this system because rsync will create new directories, if needed, on /mnt to hold new files.

Next I will burn the contents of the /mnt directories to DVD for long-term storage.

1 comment:

Anonymous said...

rsync is an awesome tool to use for this purpose. I use it to backup my notebook to my personal backup server every night. Using rsync, ssh, keychain and cron it all happens while I sleep.

my backup script first "sources" my keychain file

source /home/me/.keychain/notebook-name-sh

rsync -v -u -a --rsh='ssh -i /home/me/.ssh/my-ida_rsa' \
--stats \
/home/me/ \
mybackupuser@server:/home/mybackupuser/backups/notebook/


Keychain is very handy but I would only use it on a well protected single user system. The alternative is to use a password-less ssh key but I can't bring myself to do that. A quick google search found this little keychain howto.
http://www.cs.utah.edu/support/faq/faq-ssh.html