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?
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).
Quote from github:
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.
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.
incron (as suggested to me on this site earlier this year).
It's still no substitute for a proper backup procedure though.
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
You can maybe check chironfs http://www.furquim.org/chironfs/
https://github.com/perfecto25/poni
inotify-based rsync daemon, written in crystal lang