Skip to main content
24 votes
Accepted

Sync a folder between 2 computers, with a filesystem watcher so that each time a file is modified, it is immediately replicated

Following @Kusalananda's comment, I finally spent a few hours testing Syncthing for this use case and it works great. It automatically detects changes on both sides and the replication is very fast. ...
Basj's user avatar
  • 2,619
23 votes

Is there anything similar to rsync to syncing block devices?

Some versions of rsync have this capability (it depends on your distro). There are 2 patches that distros commonly apply to rsync. One for reading from block devices (provides the --copy-devices flag),...
phemmer's user avatar
  • 73.9k
22 votes

Why does rsync keep skipping the directory I want to sync?

The rsync command didnt include the /Users/davea/Documents/workspace/dental/ directory as the -a was not used. Adding -a flag also includes the -r (recursive) flag in the operation thus allowing the ...
Atul's user avatar
  • 1,911
20 votes

How to sync two folders with command line tools?

The answer from TuxForLife is pretty good, but I strongly suggest you use -c when syncing locally. You can argue that it's not worth the time/network penalty to do it for remote syncs, but it is ...
Bruno Bronosky's user avatar
18 votes

Sync a folder between 2 computers, with a filesystem watcher so that each time a file is modified, it is immediately replicated

Sounds like Unison should do the job. Unison is a file-synchronization tool for OSX, Unix, and Windows. It allows two replicas of a collection of files and directories to be stored on different ...
TooTea's user avatar
  • 2,828
14 votes

Is there anything similar to rsync to syncing block devices?

Nowadays, rsync supports copying devices, with: rsync --copy-devices --write-devices <FROM> <TO> Beware that it only writes to a device if it finds an actual device node. So don't use /...
Stefan's user avatar
  • 313
12 votes

Is there truth to the philosophy that you should sync; sync; sync; sync?

Old-timer here. Back in the glory days of TAPE, 3 rapid sync's in a row was a way to tell the TAPE controllers to not just un-link/unspool the tape-stream, but to rewind it as well, i.e. set the FD/...
ibisum's user avatar
  • 221
11 votes

Chrony 3.1 refuses to sync with ntp server

There is a similar bug in RH Bugzilla that was closed as notabug. The issue is a combination of poor time server and a change in defaults for newer chrony to not use them. https://bugzilla.redhat.com/...
Chris Cheney's user avatar
10 votes

Is there truth to the philosophy that you should sync; sync; sync; sync?

There were certainly older UNIX systems for which it was safer to sync more than once, but not all on one command line as "sync; sync; sync". In the mid-80s, this became distilled to: When ...
Win's user avatar
  • 211
10 votes

When and why should I sync a file in Linux?

From the sync manpage: The kernel keeps data in memory to avoid doing (relatively slow) disk reads and writes. This improves performance, but if the computer crashes, data may be lost or the file ...
dr_'s user avatar
  • 32.4k
10 votes
Accepted

Keep two entire Linux desktop systems in sync

Starting from the bottom: maybe handle user data (e.g. /home) and the system (/usr, /var, /etc) with separate tools (I'm thinking git vs rsync) Right approach! In fact, most distros, debian ...
Marcus Müller's user avatar
8 votes

Real-time file synchronization

Syncthing might be an option. It's extremely fast, transfer is encrypted and there are clients for multiple platforms. It uses "inotify" to sync changed files instantly.
njam's user avatar
  • 181
8 votes

How to sync two folders with command line tools?

This is what I'm using for backing up personal files, where I don't care about everything covered by -a, and want more useful information printed. rsync -rtu --delete --info=del,name,stats2 "/...
Honest Abe's user avatar
7 votes

Is there a way to sync only one partition?

It is now possible with sync -f: sync -f /mount/point Excerpt from sync(1): -f, --file-system sync the file systems that contain the files
Artefact2's user avatar
  • 311
6 votes

How to sync terminal session command history in bash?

While I like being able to share history between terminals, especially new terminals. I would not want to share each and every command as it happens, as one window is often doing a specific task, ...
anthony's user avatar
  • 670
6 votes
Accepted

How to transfer a part of a file from remote system via SCP?

With SCP alone, there isn't really any solution. The protocol only allows for full file copies, not partial transfers. If you're willing to look beyond just SCP, there are a couple of options: Use a ...
Austin Hemmelgarn's user avatar
6 votes

Has 'sync' been proved to be necessary when writing to a block device with 'dd'?

It's about time to answer this. For such a long time, I've been thinking that only writes to filesystems were cached, not block devices, only to discover that I was wrong : writes to block devices are ...
NovHak's user avatar
  • 399
6 votes

Moving /var onto different disk/partition

You can use a bind mount to access the original device. This does assume that the new /var is on a different partition. mountpoint /var # confirm that /var is mounted on a different partition. If ...
doneal24's user avatar
  • 5,943
5 votes
Accepted

How to sync email contacts between computers for use in mutt?

You definitely want to sync your contacts via CardDav (+calender via CalDav?). To sync up use vdirsyncer, it's basically the same what offlineimap is doing for mutt. Khard is a nice address book for ...
ploth's user avatar
  • 1,119
5 votes
Accepted

How does echoing an echo not just echo in a cronjob?

You're completely missing the point/philosophy of how Linux uses RAM. RAM is a wasted resource if it's completely free and the OS is having to access the HDD for files, therefore in Linux it ...
slm's user avatar
  • 380k
5 votes
Accepted

What does the sync command sync in fact?

The sync command uses the sync system call. The manual of the sync system call says: sync() causes all pending modifications to filesystem metadata and cached file data to be written to the ...
RalfFriedl's user avatar
  • 9,239
5 votes

Calling sync without root privileges

Yes, sync called with no arguments will cause all dirty buffers to be flushed to disk, regardless of the identity of the user running it. This is also true of the other modes some implementations of ...
Stephen Kitt's user avatar
5 votes
Accepted

Bash frequently fails to redirect stdout to a file (from cat)

Upon running cat >> file, the shell opens file in the current working directory in O_WRONLY|O_CREAT|O_APPEND in a child process on fd 1 and if successful executes cat in that process. If not, ...
Stéphane Chazelas's user avatar
5 votes
Accepted

PTP time syncing not working, why its always selecting best master clock as local clock?

The Best Master Clock Algorithm (BMCA) goes as follows: Priority 1 Clock Class Clock Accuracy Clock Offset Variance Priority 2 Clock Identity Steps removed In your case, the Priority 1 of the two ...
Jörg W Mittag's user avatar
4 votes
Accepted

Automatically keep 2 files in sync

If the two files are located on the same filesystem (i.e., not on two different partitions), then you could create one file as a hard link: ln /path/to/one_file /path/somewhere/other_file After ...
Kusalananda's user avatar
  • 356k
4 votes

sync option in /etc/fstab

Read caching is not prohibited. Write caching is prohibited. In other words, writes to the device have to be done immediately, so there is no risk of data loss.
RalfFriedl's user avatar
  • 9,239
4 votes
Accepted

Offline time sync

The important thing to note is that the on-machine clock isn't necessary trustworthy; it can drift, and different machines drift at different rates. ntp tries to measure that drift, but it needs ...
Stephen Harris's user avatar
4 votes

Understanding sync command operations in linux

This manpage might clarify things a bit. What I read between the lines is that every filesystem implementation has to provide a sync-method. So the sync command just calls the Kernel, which in turn ...
Nils's user avatar
  • 18.6k
4 votes

Unison and version/compiler conflicts

When you need to sync several computers with different operating systems, if you don't want to be compiling from source every time Unison and/or OCaml change something, there is one clean solution ...
zasjls's user avatar
  • 41

Only top scored, non community-wiki answers of a minimum length are eligible