easier linux backups to a USB drive

Monday 7th April 2008 10:24 PM

TAGS: linux, backups

I shared a little tip about backing up to a USB drive a while back, and after a bit of tinkering, I have a new method which uses rsync to speed things up a bit, and as the name suggests, keep things in sync rather than just blindly copying.

The other thing that I'm suggesting, is that you mount/unmount the USB drive between backups, mainly to protect the filesystem if it's mounted when the power goes out, or if you have to grab it in a hurry.

So here is what I suggest setting up as a cronjob (replace sdb1 with your own usb drive info):

mount /dev/sdb1 /mnt/backup
rsync -vrlptg --del /path/to/photos/ /mnt/backup/photos
umount /mnt/backup/

Important to note, I have used the --del option here, which means files deleted from the source location, will also be deleted on the backup drive. Since I use my backup drive more as a "mirror" of the data, rather than an archive - this works well for me, your situation may be different.

A nice way of going about protecting your data, is to use 2 (or more) drives and alternate them once a week, this script will keep whichever one you have plugged in up-to-date.

Comments on this article:


I love feedback and comments, be the first!

Add Comment:


Make a Comment

*Nb, all comments are moderated to prevent spam or inappropriate content.








netforge logo
netforge provides high quality and friendly website design services to business. We're Australian based and reliable... (find out more).