Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Does anyone have a bash script that will only backup new or modified files inside a specific directory?

Basically, what I'm looking for is an incremental backup. I've been running a full backup for a couple days now and it's just not practical.

share|improve this question

4 Answers 4

I'd suggest rsnapshot.

share|improve this answer
man rsync

it does exactly what you need

to be more specific - you must have rsync --daemon on the machine with the files and the following command on the machine the backup is stored

/usr/bin/rsync -avz /some/dir/to/store/the/backup

where is the ip of the machine and ETC is defined in /etc/rsyncd.conf as seen below

        comment = etc
        path = /etc
        use chroot = yes
        list = no
        uid = 0
        gid = 0
        read only = yes
        hosts allow =,
        hosts deny =
        transfer logging = yes

also, port 873/tcp must be allowed in the firewall

share|improve this answer
If you have SSH access to the other box, you don't need rsync --daemon on the other end. Just rsync -avz mylocaldir remoteuser@remotehost:backupDir is sufficient. – François Feugeas Nov 2 '09 at 14:12

rsync cannot create incremental backups. Try rdiff-backup.

share|improve this answer
That's not what man rsync suggests. See the --backup-dir=DIR option. – pavium Oct 24 '09 at 12:06
that's why some people use tools which come with the distro, and others use third-party apps/scripts/etc - the patience to read manpages :) – petre Oct 24 '09 at 12:35

rdiff-backup is honestly your best bet for this. I've been using it for about 2 years on a fairly large and active box. Using it is pretty straight forward:

rdiff-backup /my_active_dir /my_backup_dir/

If you're interested in backups over a network, check out Duplcity (Google for it, I can't post two links apparently) which works under the same concept but sends encrypted volumes to wherever you wish. Even supports Amazon S3.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.