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

I would like to sync a directory of an internal hard drive to an external hard drive.

When I write or modify a file on my internal hard drive, automatically the same file would be copied to the external hard drive... and bye bye backup ;)

This would be something like a RAID with an external hard drive.

Is this possible?

share|improve this question
I'm afraid that thinking "bye bye backup" is almost never appropriate, or correct. – Ben Pilbrow Jun 6 '10 at 10:57

6 Answers 6

up vote 5 down vote accepted

In real time as far as i know there's only DRDB
But I don't think it applies at your situation, since when you delete a file you'll delete it also on the external disk. More easily you can use rsync and a cron script that run every few minutes.

share|improve this answer
Thank you for your answer. But if "cron" rsync to run every ..5 minutes, does it compromise performance ? Isn't it too heavy (it check every files if something is changed ?) ? – stighy Jun 6 '10 at 11:16
That's why they invented file system with snapshots capabilities ;) – Pier Jun 6 '10 at 11:31
DRBD can be a bit complicated to configure, if you need help configuring it I wrote a nice article: – Itai Ganot Aug 31 at 9:14

lsyncd seems to be the perfect solution. it combines inotify (kernel builtin function witch watches for file changes in a directory trees) and rsync (cross platform file-syncing-tool).

lsyncd -rsyncssh /home backup-home/

Quote from github:

Lsyncd watches a local directory trees event monitor interface (inotify or fsevents). It aggregates and combines events for a few seconds and then spawns one (or more) process(es) to synchronize the changes. By default this is rsync. Lsyncd is thus a light-weight live mirror solution that is comparatively easy to install not requiring new filesystems or blockdevices and does not hamper local filesystem performance.

share|improve this answer

You can just create a Software RAID1 over your internal and external hard drives. For the system it doesn't make a difference if it's a built-in hard drive or an externally attached mass storage.

But RAID is no backup! What happens if you accidentally delete a file on your hard drive? It also gets deleted on your external "backup" drive.

Backups usually comprise more than one generation of files so you can retrieve accidentally deleted files from it.

share|improve this answer
A big +1 for the explicit "RAID is not backup". – nickgrim Jun 21 '12 at 11:29

incron (as suggested to me on this site earlier this year).

It's still no substitute for a proper backup procedure though.

share|improve this answer
probably better would be to engrave it into stone. – Dee May 23 '13 at 19:58
@Dee Please explain this comment. Is incron not a good solution? – imolit Feb 27 at 14:01

You can maybe check chironfs

share|improve this answer

git-annex can also be used to achieve this.

git-annex allows managing files with git, without checking the file contents into git. While that may seem paradoxical, it is useful when dealing with files larger than git can currently easily handle, whether due to limitations in memory, time, or disk space

There is a walkthrough to quickly bring users up to speed with git-annex

share|improve this answer
Whilst this may theoretically answer the question, [it would be preferable] to include the essential parts of the answer here, and provide the link for reference. – Itai Ganot Aug 31 at 9:05

Your Answer


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

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