Lsyncd (Live Syncing Daemon) synchronizes local directories with remote targets
Go to file
Daniel Poelzleithner e1e13503b2 Use github discussions 2023-03-03 14:37:43 +01:00
.github/workflows disable lua 5.4.4 due segfault on luac invocation 2022-11-11 18:05:50 +01:00
cmake change header discription 2022-02-24 14:40:46 +01:00
docs Use github discussions 2023-03-03 14:37:43 +01:00
examples Fix more warnings from static code analysis 2022-11-11 15:27:21 +01:00
m4 Try harder to find matching Lua program/library pairs 2012-10-02 15:58:52 +02:00
tests Allow lsyncd to be build in the source folder without breaking. Not recommended 2022-11-11 19:32:09 +01:00
.editorconfig add .editorconfig 2022-03-11 07:12:39 +01:00
.gitignore fix cron test 2022-11-11 18:26:57 +01:00
CMakeLists.txt Update docs and build manpage on build process 2023-03-03 14:25:46 +01:00
COPYING Fix documentation spelling bits, and a few links 2013-05-04 13:11:09 +10:00
ChangeLog fix changelog dates 2022-11-17 15:43:48 +01:00
INSTALL preparing 2.2.3 2018-03-09 10:08:21 +01:00
README.md Fix spacing/wording 2023-03-02 17:22:01 +01:00
bin2carray.lua fix script integration 2011-05-04 13:18:37 +00:00
config.h.in Remove /System/Volumes/Data from fsevent paths on macOS 2020-09-25 15:36:25 -04:00
default-direct.lua Finish full sync cron trigger 2022-06-03 06:45:38 +02:00
default-rsync.lua Fix more warnings from static code analysis 2022-11-11 15:27:21 +01:00
default-rsyncssh.lua Check ssh arguments and issue warning 2023-03-02 18:45:58 +01:00
default.lua Fix more warnings from static code analysis 2022-11-11 15:27:21 +01:00
distclean.sh adding a distclean script 2016-12-13 14:56:23 +01:00
flake.lock update nix locks 2022-10-28 15:12:54 +02:00
flake.nix Update docs and build manpage on build process 2023-03-03 14:25:46 +01:00
fsevents.c Remove /System/Volumes/Data from fsevent paths on macOS 2020-09-25 15:36:25 -04:00
inotify.c cleanups 2018-03-09 15:41:16 +01:00
lsyncd.c lua 5.4 fixes 2022-06-03 07:07:08 +02:00
lsyncd.h add onepass option to exit after initial sync 2018-12-05 17:05:18 +11:00
lsyncd.lua Fix spacing/wording 2023-03-02 17:22:01 +01:00

README.md

Lsyncd -- Live Syncing (Mirror) Daemon

Description

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 block devices and does not hamper local filesystem performance.

Rsync+ssh is an advanced action configuration that uses a SSH to act file and directory moves directly on the target instead of re-transmitting the move destination over the wire.

Fine-grained customization can be achieved through the config file. Custom action configs can even be written from scratch in cascading layers ranging from shell scripts to code written in the Lua language. This way simple, powerful and flexible configurations can be achieved. See the manual for details.

Lsyncd 2.2.1 requires rsync >= 3.1 on all source and target machines.

License: GPLv2 or any later GPL version.

When to use

Lsyncd is designed to synchronize a local directory tree with low profile of expected changes to a remote mirror. Lsyncd is especially useful to sync data from a secure area to a not-so-secure area.

2-way/bidirection synchronization

It is not possible to use lsyncd to synchronize for example folder1 with folder2 and vice versa. Only one source to one target. Two way synchronization is a very hard problem that needs specialized tools. Imagine you start writing a very large file to folder1, lsyncd will start synchronizing this file to folder2, which might be on a different machine. The lsyncd on that machine will see a new file, and try to synchronize it back to folder1. If at the same time, you change bytes in this file, those changes will be overwritten with old data. Using lsyncd in such a way might work in practice, but data corruption is easily possible if you write into files afterwards. git-annex is a good way to do this, if you don't mind working with git repositories. It stores each change as a revision that can be rolled back.

Other synchronization tools

DRBD operates on block device level. This makes it useful for synchronizing systems that are under heavy load. Lsyncd on the other hand does not require you to change block devices and/or mount points, allows you to change uid/gid of the transferred files, separates the receiver through the one-way nature of rsync. DRBD is likely the better option if you are syncing databases.

GlusterFS and BindFS use a FUSE-Filesystem to interject kernel/userspace filesystem events.

Mirror is an asynchronous synchronisation tool that takes use of the inotify notifications much like Lsyncd. The main differences are: it is developed specifically for master-master use, thus running on a daemon on both systems, uses its own transportation layer instead of rsync and is Java instead of Lsyncd's C core with Lua scripting.

git-annex allows managing large files with git, without storing the file contents in git. It can sync, backup, and archive your data, offline and online. Checksums and encryption keep your data safe and secure. Bring the power and distributed nature of git to bear on your large files with git-annex.

git-annex is designed for git users who love the command line. For everyone else, the git-annex assistant turns git-annex into an easy to use folder synchroniser.

Wikipedia Comparison of file synchronization software

Lsyncd usage examples

lsyncd -rsync /home remotehost.org::share/

This watches and rsyncs the local directory /home with all sub-directories and transfers them to 'remotehost' using the rsync-share 'share'.

lsyncd -rsyncssh /home remotehost.org backup-home/

This will also rsync/watch '/home', but it uses a ssh connection to make moves local on the remotehost instead of re-transmitting the moved file over the wire.

Some more complicated examples, tips and tricks you can find in the manual.

Disclaimer

Besides the usual disclaimer in the license, we want to specifically emphasize that the authors, and any organizations the authors are associated with, can not be held responsible for data-loss caused by possible malfunctions of Lsyncd.