Wednesday, April 14, 2010

Using rsync for backups

Previous: Renaming FAT32 and NTFS filesystems

Being a n00b and all, it's probably no surprise to you that I've been backing up my files by dragging and dropping folder icons in Nautilus. Knowing that, it's probably no surprise that these backup operations might take hours to complete. I used to start a backup operation before going to bed, and leave it running while I slept.

I had n00bishly assumed that when gnome asked me if I wanted to merge files with matching names, it would only copy those files that were different than the version on the target. After all, that would be the logical thing to do, wouldn't it? No such luck.

Then I discovered a very useful file syncing utility, rsync. It's already installed on Ubuntu as shipped. It's nothing new, but it's new to me. It only copies files that have changed.

I found I could back up any of my top-level directory trees to an external drive quickly. For example, this command backs up my /usr directory, which is the mount point of a partition on the internal hard drive:
sudo rsync -av /usr /media/1TB_HDD_external/
The first time, when there was nothing at the destination location, rsync took about 15 minutes to back up a partition of 320GB+. Subsequently, it ran in just a couple of minutes. Very convenient!

It was easy to script this so that everyday backups are easy to run. For instance, this
backup personal
will run
sudo rsync -av /home/dave/Personal /media/1TB_HDD_external


Next: Installing Oracle Express and ADF - FAIL!

No comments:

Post a Comment