I've been using this simple command (that's all I can do :) to backup the whole tree from my user data in NAS server for a year.


Unfortunately, after a year of service. My user start filling the spaces with lot of photo and cliparts (jpg, gif, bmp) And that start to make my backup process get much slower. The space is also a big issue. Now I no longer have enough space for a week-long daily backup set.

I think I want to change from backup everything to backup only non-image data. How can I exclude jpg, gif, and bmp from the backup ? It's quite easy with DOS XCOPY command, but I really have no idea how to do that in bash.


5 Answers 5


take a look at rdiff-backup. it will not keep replicas of unchanged files, just the 'diffs'.

if you want to keep on copying - use rsync rather than cp and take a look at syntax of exclude directive eg as described here.

do remember to verify if your backups work [especially with rdiff or any other 'advanced' backup - verify the repository, try restore procedure from time to time].

  • Please, excuse my ignorance. I thought rsync require rsync server to be installed. I have a small NAS that have 2HD installed. I simply cp data from one disk to another. Does rsync useful to me in this scenario ?
    – Sake
    Commented Apr 25, 2010 at 14:51
  • 3
    rsync works also on local directories, w/o any server involved. Commented Apr 25, 2010 at 14:55
  • 1
    @Sake - as Dan says - you can use rsync [ or rdiff ] locally, or via smb [windows network shares] or via nfs... or via ssh [and then you need rsync at the remote machine too]. chances are your NAS is actually running linux - look around it. mine has ssh and rsync already installed - it's WESTERN DIGITAL MYBOOK WORLD NEW EDITION. amuway - as long as you can reach it somehow via shares - you can use rsync without any hacks on the NAS side.
    – pQd
    Commented Apr 25, 2010 at 16:49

In Linux you have always the option of using the good ole tar, using --exclude or --exclude-from options


If you want to stick with a full backup every day strategy, you can use rsync with some --exclude flags to copy only non-image data.

If you wanted to further reduce the size of your backups, you could compress the backup copies; the quickest and easiest way to do that would be to use tar to make the archive (so the output would be a single file) with -z or -j.

You can further reduce your size by doing a more traditional backup model, with weekly full backups and daily incrementals, with tar or find+tar.

  • find+tar or find+cp that's the answer I'm looking for. But it's a bit more complex than XCOPY and I may need some time learning to do that.
    – Sake
    Commented Apr 25, 2010 at 14:53

You don't mention the brand of your NAS device. Some higher-end NAS appliances (Netapp, Isalon, DataDomain) support deduplication.

This would allow you to do full daily backup, and any data would be 'deduplicated' on the appliance. This deduplication/compression is completely transparent to the user (/home/user/myimages/fooimage.tiff looks exactly the same throughout the backup history).

I did this for a 300GB filesystem, and we were able to keep close to two years worth of backups on a single appliance.

And I know this is a bit of a tangent, but some cheaper solutions should now be available using Sun's ZFS. ZFS also does de-duplication, although it's a little immature compared to Netapp or DataDomain's offerings. Next time I look, I'm considering ZFS, possibly when FreeNAS 8.0 comes out.

However, if you don't have one of these, then 'rdiff-backup' works pretty well also.


I second tar or rsync. find would work as well but could potentially hit some limits depending on the number of files in this tree. rsnapshot is pretty nice too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .