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?

  • 23
    I'm afraid that thinking "bye bye backup" is almost never appropriate, or correct. Jun 6, 2010 at 10:57
  • Seriously. What Ben said. This is NOT a substitute for backup. Jul 17, 2018 at 18:54

7 Answers 7


In real time as far as i know there's only DRBD. 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.

  • 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, 2010 at 11:16
  • That's why they invented file system with snapshots capabilities ;)
    – PiL
    Jun 6, 2010 at 11:31
  • 1
    DRBD can be a bit complicated to configure, if you need help configuring it I wrote a nice article: geek-kb.com/install-and-configure-drbd-centos-6
    – Itai Ganot
    Aug 31, 2015 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 remotehost.org 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.

  • 2
    the con is it is not bidirectional
    – tymik
    Oct 2, 2017 at 13:30

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.

  • 5
    A big +1 for the explicit "RAID is not backup".
    – nickgrim
    Jun 21, 2012 at 11:29
  • Also a software raid with internal and external hard drive members is probably going to be very slow, unreliable and designated to break pretty often.
    – David
    Sep 12, 2016 at 14:34

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

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

  • 3
    probably better would be to engrave it into stone.
    – Dee
    May 23, 2013 at 19:58
  • 1
    @Dee Please explain this comment. Is incron not a good solution?
    – imolit
    Feb 27, 2015 at 14:01

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

  • 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, 2015 at 9:05

You can maybe check chironfs http://www.furquim.org/chironfs/

  • this looks being abandoned
    – kyb
    Jan 18, 2022 at 10:16


inotify-based rsync daemon, written in crystal lang

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.