Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

How to Mirror Local and Remote Directories on a VPS With lsyncd

A practical lsyncd guide for one-way local-to-VPS mirrors: prerequisites, SSH keys, default.rsyncssh configuration, foreground testing, deletion safety, and troubleshooting.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run lsyncd on the machine that contains the source directory, use its default.rsyncssh action to reach the VPS over SSH, and test the mirror in the foreground before enabling a service. Lsyncd batches filesystem events for a short delay and starts rsync asynchronously; it is a one-way mirror, not a backup, and normal settings can delete destination files that no longer exist in the source.

What lsyncd does—and what it does not do

Lsyncd (Live Syncing Daemon) watches a local directory tree through the operating system’s filesystem-event interface, such as inotify on Linux. It collects changes for a configured delay, then launches rsync to apply those changes to another filesystem. The result is an asynchronous, event-driven mirror rather than block-level replication.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The daemon belongs on the source machine. If your working files are on a workstation or an application server and the VPS is the destination, install and run lsyncd on that workstation or server. If the VPS contains the source and another host is the destination, reverse the roles. Lsyncd does not create a two-way synchronization relationship: changes made only on the destination are not sent back.

The project describes lsyncd as intended for a slowly changing local directory tree mirrored to a remote filesystem. A web-content tree, deployment directory, media staging folder, or build output is a reasonable fit. A busy database directory, virtual-machine disk, or workload that changes blocks continuously needs a replication design that understands the application and its consistency requirements.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Why use default.rsyncssh for a VPS

For a remote VPS, the built-in default.rsyncssh action is generally the right starting point. It transfers file content with rsync and uses SSH for remote operations. In particular, remote moves and directory operations can be performed on the VPS itself instead of deleting the old path and retransmitting the moved data. That can substantially reduce unnecessary transfer when files are renamed or moved within the destination tree.

The action separates the remote host from the destination path:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • host contains the SSH login, such as [email protected].
  • targetdir is the absolute directory on that VPS, such as /srv/site/.
  • source is the absolute local directory watched by lsyncd.

The simpler default.rsync action can also use an SSH-style rsync destination, but it does not provide the same SSH-side move handling. Choose it only when that behavior is acceptable or when you have a specific reason to use the simpler transport.

Prerequisites and safety checks

Install compatible software on both hosts

  • Install lsyncd and rsync on the source machine.
  • Install rsync on the VPS as well; rsync must be available at the remote end of an SSH transfer.
  • Lsyncd 2.2.1 requires rsync 3.1 or newer on every source and target machine. Check the installed versions with lsyncd -version and rsync --version, and verify the VPS separately over SSH.
  • Use absolute paths for both directories. Confirm that the source path is the tree you actually intend to publish and that the target path is not a parent directory containing unrelated data.

Package names and service-unit names differ between Linux distributions. Use your distribution’s package manager, then verify the binaries rather than assuming that a package installation succeeded.

Create a noninteractive SSH login

A daemon cannot stop to ask for a password or accept a host-key prompt. Create or select a key pair for the account that will run lsyncd, install the public key in the VPS account’s ~/.ssh/authorized_keys, and test that account before writing the daemon configuration. The account needs permission to create, modify, move, and delete files inside the remote target directory.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

For a root-run service, the private key might be /root/.ssh/id_ed25519. For a service running as an unprivileged user, place the key in that user’s home directory and use the corresponding path. Restrict the private-key permissions and avoid relying on an agent that is available only in your interactive login session.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test the exact identity and host as the daemon user:

ssh -i /root/.ssh/id_ed25519 [email protected]

Do not continue until this command logs in without a password prompt and the account can create and remove a harmless test file in the target directory.

Decide what must never be mirrored

Make an inventory before the first synchronization. Temporary editor files, sockets, caches, secrets, local credentials, build scratch space, and active database files are common exclusions. A mirror is not a backup: if an item is absent from the source, ordinary lsyncd behavior can remove the corresponding pre-existing item on the VPS. Keep an independent backup if the destination contains anything that must survive a source mistake.

Build the configuration

Create the configuration at /etc/lsyncd/lsyncd.conf.lua when that is the path used by your distribution. The following example watches /srv/site/ and mirrors it to the same path on a VPS:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
settings {
  logfile        = "/var/log/lsyncd/lsyncd.log",
  statusFile     = "/var/log/lsyncd/lsyncd.status",
  statusInterval = 20,
}

sync {
  default.rsyncssh,
  source    = "/srv/site/",
  host      = "[email protected]",
  targetdir = "/srv/site/",
  delay     = 15,
  rsync = {
    archive  = true,
    compress = true,
    verbose  = true,
  },
  ssh = {
    identityFile = "/root/.ssh/id_ed25519",
    port         = 22,
  },
}

This is Lua syntax. Keep commas, quotes, and braces intact; a syntax error prevents lsyncd from starting.

Understand each setting

Setting Purpose What to verify
logfile Writes daemon and synchronization messages to a file. The parent directory exists and the lsyncd user can write it.
statusFile Records status information for monitoring. The path is writable and is included in log rotation or monitoring plans.
statusInterval Sets how often status information is updated; the example uses 20 seconds. Choose an interval that gives useful visibility without unnecessary churn.
source Absolute local tree watched for filesystem events. It is the intended source, with a trailing slash matching your desired rsync semantics.
host SSH user and VPS hostname. The same combination works in a standalone SSH test.
targetdir Absolute directory on the VPS. The SSH account owns it or has the required permissions.
delay Seconds lsyncd waits while batching events before starting rsync; the example uses 15. A longer delay reduces bursts but increases the time before a change appears remotely.
rsync.archive Passes archive behavior to rsync for normal metadata-preserving synchronization. Confirm that the remote account and filesystem support the metadata you need.
rsync.compress Compresses rsync transfers, useful when bandwidth is more constrained than CPU. On a fast private network, measure whether compression is worthwhile.
rsync.verbose Adds transfer detail to diagnostics. Reduce verbosity later if logs become too large.
ssh.identityFile Private key used by the daemon. Use an absolute path readable by the service user.
ssh.port SSH TCP port; the example uses 22. Set the VPS’s actual SSH port if it differs.

Adjust the source, host, target, identity, and port before starting. Do not copy the example’s paths into a production configuration without checking ownership and mount points.

Validate the mirror in the foreground

Foreground validation catches bad Lua syntax, wrong paths, missing permissions, and SSH problems before a service hides the error. Run:

sudo lsyncd -nodaemon /etc/lsyncd/lsyncd.conf.lua

The -nodaemon option keeps lsyncd attached to the console so startup and transfer errors are immediately visible. Leave this process running while you perform controlled tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a test file. Run printf 'mirror testn' > /srv/site/lsyncd-test.txt. After the configured delay and transfer, confirm that /srv/site/lsyncd-test.txt exists on the VPS.
  2. Edit the file. Change its contents and verify that the remote copy changes rather than creating a second file.
  3. Rename it. Move it to a new name locally and check the remote tree. With default.rsyncssh, SSH-side operations can handle remote moves locally instead of retransmitting unchanged data.
  4. Delete it. Remove the test file only after confirming that you understand the deletion behavior, then verify the remote copy is removed.
  5. Inspect diagnostics. Read the configured log and status files while each event is processed. Look for authentication failures, permission errors, an incorrect target path, or repeated retries.

Use a disposable target directory for this exercise. Never test deletion behavior against a VPS directory that contains the only copy of important data.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Run lsyncd as a service

Once the foreground run completes successfully, stop it and start the service provided by your Linux distribution. Some packages register an lsyncd systemd unit; others require a distribution-specific daemon command. Use that unit rather than launching a second copy by hand.

After starting the service, confirm all of the following:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The process is running under the user that owns the configured SSH key and source directory access.
  • The configured log file receives startup and synchronization messages.
  • The status file is updated at the configured interval.
  • A new harmless file reaches the VPS after the expected delay.
  • Only one lsyncd instance is watching the source tree.

For a systemd installation, a typical workflow is to check the unit’s status and journal with your distribution’s systemctl and journalctl commands. If the package uses another init system, follow its service-management equivalent.

Deletion, drift, and consistency risks

Why files disappear on the VPS

Normal mirror configuration removes destination files that are not present in the corresponding source directory. Therefore, a source deletion propagates as a remote deletion. The same outcome can occur if source points at an empty mount, an unmounted filesystem, or the wrong directory: lsyncd may interpret the visible source tree as authoritative and remove files from the target.

Protect yourself by checking mounts and paths before starting, using a disposable target for initial tests, excluding data that should not be managed, and maintaining a separate backup. Do not treat the remote mirror as a versioned recovery point.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Asynchronous delivery is not instant replication

A filesystem event is queued, grouped with nearby events, and transferred after delay and any currently available process capacity. A 15-second delay is only an example; under load, the queue can take longer. Applications that require every write to be synchronously durable on two hosts need a different architecture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Databases and highly concurrent trees

Do not point a basic lsyncd tree mirror at active database files or other workloads that change rapidly at block level. A file may be copied while an application is still modifying it, producing a remote file that is not a transactionally consistent snapshot. Use the database’s replication or backup mechanism, or quiesce the application and copy a consistent snapshot.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing transport and behavior

Decision default.rsyncssh default.rsync
Remote VPS over SSH Designed for this arrangement; specify host, targetdir, and an ssh table. Can use an SSH-style rsync destination, but has fewer SSH-specific operations.
Moves and renames Can use SSH commands to move files or directories on the target instead of deleting and retransmitting them. Uses the standard rsync behavior; moved content may be handled less efficiently.
Configuration clarity Separates login host from the remote directory. Usually expresses the destination as a combined rsync target.
Authentication controls Supports an identity file, port, and additional SSH options. Depends on the SSH options exposed by the chosen rsync invocation.
Direction One-way source to destination. One-way source to destination.

Transport choice does not change the fundamental mirror warning: rsync still reconciles the destination with the source, and deletions can propagate.

Useful command-line shortcuts

For a quick experiment, the lsyncd invocation interface provides a direct rsync form:

lsyncd -rsync /home/USER/src remotehost:dst

The SSH-aware form separates the remote host and target directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
lsyncd -rsyncssh /home/USER/src REMOTEHOST TARGETDIR

These shortcuts are useful for confirming that event watching and connectivity work before you create a full Lua configuration. The invocation interface also supports multiple targets and a -version option. For a long-running service, use a configuration file so logging, status reporting, SSH identity, delay, and rsync behavior are explicit and reviewable.

Troubleshooting by symptom

Symptom Likely cause Fix
Lsyncd exits immediately with a configuration error. Lua syntax error, missing comma, or an invalid option. Run with -nodaemon, read the exact line reported, and compare the file with the documented action and settings.
SSH works interactively but lsyncd cannot connect. The service runs as another user, cannot read the key, or is waiting for a host-key/password prompt. Run the SSH test as the daemon user with the same -i key, install the host key in advance, and use key-based authentication.
Files arrive locally but not on the VPS. Wrong targetdir, missing remote write permission, unavailable rsync, or a queued transfer still waiting for delay. Check the log, verify the remote directory manually over SSH, confirm rsync on the VPS, and wait through the configured delay.
Renames appear as a delete followed by a full upload. The simpler rsync action is in use or the remote move cannot be performed. Use default.rsyncssh, verify SSH permissions, and inspect the log for remote move failures.
Remote files vanish unexpectedly. Source deletion, an incorrect source path, or an unmounted source filesystem. Stop the service, inspect mounts and paths, restore from a separate backup if necessary, and restart only after the source tree is confirmed.
The status file never changes. Its directory does not exist, is not writable, or the daemon is not running the configuration you edited. Check ownership and permissions, confirm the active service command and configuration path, and inspect startup logs.
Transfers remain behind during bursts of changes. The tree is changing faster than asynchronous rsync jobs can complete. Increase capacity carefully, adjust the delay, reduce unnecessary files with exclusions, or choose a replication method intended for that workload.

Production checklist

  • Both machines run compatible rsync versions; for lsyncd 2.2.1, that means rsync 3.1 or newer on source and target.
  • The SSH key works noninteractively for the exact service user, host, port, and identity file.
  • The source and target are absolute paths, and the target is not a directory containing unrelated files.
  • The remote account can create, modify, move, and delete within the target.
  • Temporary files, sockets, caches, secrets, and active database files are excluded or kept outside the watched tree.
  • You have a separate backup; the VPS mirror is not a backup or version history.
  • You tested create, edit, rename, and delete events with -nodaemon.
  • Logs and the status file are writable, monitored, and covered by your retention policy.
  • You understand that the configured delay means the mirror is eventually consistent, not synchronous.
  • You have a recovery procedure for a wrong source path or accidental deletion before enabling automatic startup.

Bottom line

For a one-way local-to-VPS mirror, install lsyncd and rsync on both hosts, establish noninteractive SSH access, configure default.rsyncssh with absolute paths, and validate every file operation in the foreground. Its event batching makes it efficient for slowly changing trees, while its mirror semantics mean deletions and path mistakes can propagate. Treat the destination as a synchronized working copy, keep an independent backup, and use application-aware replication for databases or highly concurrent data.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.