My media library isn't huge, but it isn't tiny (~50 GB). Every month or so, I just manually copy ~/Music, ~/Pictures, and ~/Videos to my EHD, and delete the old backup. But this is far from ideal. It's pretty slow, for one thing (~50 GB all together). It also isn't versioned, so if I ever want to go back multiple versions, I'm out of luck.

Is there any simple, stable, incremental way to do this? I'm open to using traditional version control systems like Git for it, although I haven't used them before for anything other than code. Command-line is fine (especially if it's scriptable). I only need to back up these 3 folders--anything that's not media is stored in my Dropbox. Any ideas?

Edit: Here is the script I ended up using (thanks Mistiry):


rsync --delete --size-only -ravv /home/matthew/Music "/media/My Passport/backup/Music"
rsync --delete --size-only -ravv /home/matthew/Pictures "/media/My Passport/backup/Pictures"
rsync --delete --size-only -ravv /home/matthew/Videos "/media/My Passport/backup/Videos"

I found --progress wasn't particularly useful, since my music is organized by albums, and each album is only around ~100mb. If it is possible to show progress for the entire rsync operation, that would be much more useful.

I used --delete so that if I clean up my library locally, it will also clean up the backup.

The vv just puts it in verbose mode, because I'm new to rsync, and I want to know if anything goes wrong.

  • 1
    Some notes: --delete is dangerous for you backup, if you accidentally delete some media and realize this too late. Exactly that happened to some of my photos, when I moved (instead of copy) some to a temporary directory before processing them to print. I realized the problem months later. Fortunately, my rsync backup was using no --delete ... Also, the -z option is probably slowing the transfer down, because a) media is usually already compressed and b) you are copying to a local drive that is fast enough. Furthermore, have a look at the --link-dest option to get reverse incremental updates.
    – IanH
    Aug 19 '10 at 20:40
  • @IanH: Thanks! I got rid of the z. I'm ok with the risk of using --delete if it simplifies my backup process. I'm backing up for "what if my hard drive fails?" I'm not worried about "what if I screw things up locally?". --link-dest seems promising, although I'll have to read up on hardlinks to make sure I understand what I'm doing.
    – Matthew
    Aug 19 '10 at 20:53
  • 1
    There are some "Howtos" describing the use of --link-dest out there. I think something like this is the best solution to solve the "delete" problem, so you can always have a look at the old backups. I'm using a 2-step backup, first from my PC and Notebook to my home router (with --delete) and the home-router backups (no --delete) to a colocated server, so my important data (especially my photo archive) is also protected from fire and other disasters. The two step solution is used because of the slow ADSL upstream.
    – IanH
    Aug 20 '10 at 8:37
  • 3
    The -a option includes -r, so you could use simply -avv instead of -ravv.
    – garyjohn
    Aug 20 '10 at 11:29

Use the program rsync, which works like an incremental backup and won't back up files that haven't changed.

Here are a few different options (obviously, change the target directory. I'm using /mnt/usb in my examples):

rsync -ra ~/Music /mnt/usb

This will recursively archive sync your files, meaning it will copy everything including directories, and will preserve ownership, timestamps, etc.

rsync -r --size-only ~/Music /mnt/usb

This will recursively sync your files, using only the file sizes to compare files (requires less CPU power, so is faster).

rsync -raz --progress --size-only ~/Music /mnt/usb

This will recursively archive compress sync your files (z means compress), using only the file sizes to compare files, and compress them before syncing. This requires more CPU, so is slower.

(Note: -ra is the same as -a. Here, -r is included just for clarity.)

Since this is something you do on a regular basis, you can add something like this to your crontab (run crontab -e to change your crontab):

* 21 1 * * /usr/bin/rsync -r --size-only ~/Music /mnt/usb
* 22 1 * * /usr/bin/rsync -r --size-only ~/Pictures /mnt/usb
* 23 1 * * /usr/bin/rsync -r --size-only ~/Videos /mnt/usb

In the above example, at 9:00pm on the 1st day of every month, your ~/Music directory will sync to /mnt/usb. At 10:00pm, ~/Pictures and at 11:00pm, ~/Videos.

  • Thanks, this is perfect! I edited my question to include the rsync script I used to solve it. Is it possible to make --progress show progress for the entire rsync operation? Right now it shows progress for each folder (album), which isn't very useful. I don't think I want to schedule the backup, because I only plug in my EHD to do the backup. But I can start using crontab to schedule other backups, like my .bashrc and .vimrc. Thanks!
    – Matthew
    Aug 19 '10 at 20:26
  • @Matthew If you want a GUI for rsync, I suggest Back in Time. Also gives you versioning.
    – digitxp
    Aug 19 '10 at 23:30
  • These days -a is an alias for -rlptgoD so you might not need the separate -r. I thought it has always done this but I'm honestly not sure.
    – Oli
    Sep 27 '16 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.