Optimal setup for mirroring computers?

I have (right now) three computers, two desktops in different physical spaces, and a laptop… I’d like to get all three computers to be ‘mirrors’ of each other so that I can use any one, and have what I’m doing appear on the others. (reasonably short delays, say an hour, are OK)

Ideally I’d like this to include any open tabs in FireFox, and possibly other files that have been saved but may still be open on one of the machines… I’d also like to mirror any non hardware related configuration stuff. I almost never log out of my machines, but wouldn’t be working on two machines at the same time…

The three machines are all Intel based, running 64-bit Debian & KDE. They have different hardware configurations, but are similar otherwise. They have a small number of different user accounts, and I’d like to mirror all the accounts.

I tried to use ST for this a few months ago and found that it seemed to work OK, but was painful to set up, in mirroring /home/me/ but when I tried to mirror /home/me, things broke badly, despite putting all the ST config files (I think) in .stignore. I haven’t tried to do much troubleshooting, but it looks like the system keys got borked… The biggest symptom is that Firefox can’t find the ST window on the local machine…

If I was to start over from scratch, which seems simplest, what is the best way to set this up? One suggestion I got was to set up a separate user account for ST, give it permission to access the other /home/{user} directories and run ST from the separate account to back up everything else (so presumably none of the ST stuff would be touched) Would this work?

Other ideas?

ex-Gooserider

Application state, like open tabs in your browser, won’t be successfully synced by something like Syncthing that just deals with files on disk. You’ll need to have your browser do that itself.

I wouldn’t recommend syncing your home directory even if you think you want everything to be mirrored, because there will inevitable be things that are machine specific. I would start with just a synced folder containing your documents and some dot files you want synced, and symlink to those from your home directory.

The application state synchronisation would only work if you absolutely make sure to close everything on the first machine, let all the files sync, and only then open the programs on the other computer. Otherwise, you will have conflicts.

I do this kind of sync with some of my software, but it does require being extra careful (and having backups just in case something goes wrong).

OK, I have decided after looking at some other options to go with syncthing for at least some of my needs.

I need to get rid of the old broken install and update to the latest version, and then start setting everything up from there…

I understand about not wanting to sync ALL the configuration files, but I’m a little unclear on setting that up.

Assuming I have a directory like ~/me/.config/program file-to-sync file-not-to-sync

Would I then set up a second directory ~/me/sync-this-stuff link-to-~me/.config/program/file-to-sync

Or would I move file-to-sync into the “sync-this-stuff” directory, and make a link to it from the ~me/.config/program directory?

Either way, I assume I don’t want to do anything to “file-not-to-sync”

ART

I have installed the latest stable (AMD64, Linux 1.14.0) on two of my machines and added all the folders I know that I want to have synced and which don’t have any configuration data I’m aware of…

The folder list says everything is up to date, but the two machines each say the remote device is “Synching” both at about 82% 18 GiB plus or minus a bit… Both are showing transfer rates usually at 0 B/s (I have upped the rate limits on both machines to over 9 GiB/s) One machine says Out of Sync Items [3,321 items, ~17.4 GiB] and the other says 10,510 items ~18.6 GiB. It has been like this for at least a few hours of intermittent watching…

Both machines are on the same wireless network, both show connected and seem able to download stuff over the net… ST seems to be running as best I can tell (Ksysguard lists two instances on each machine)

Why am I seeing this large amount of files that appear to be not synced, but not having any apparent effort to get them handled?

ex-Gooserider

Any suggestions on troubleshooting?

I assume that the Out of Sync items persist even after restarting or disconnecting and reconnecting the devices, right?

I’m asking because there is a bug currently when sharing new folders (see https://github.com/syncthing/syncthing/issues/7314). It goes away once you disconnect and reconnect the affected devices.

I hadn’t explicitly tried that before you replied (I had done at least one restart, and several rescans, but wasn’t keeping track), but since you posted, I have disconnected and reconnected both machines from the network, and both done “restarts” from the GUI, and shut down in the GUI, (which caused Firefox to report that it was unable to find the server) and restarted from the menu…

When I did this, I usually saw a few seconds of the transfer rate going up to a few hundred B/s for a few seconds, and then going back down to zero, or 1 B/s - the number of out of sync items hasn’t changed…

ex-Gooserider

Minor data point - I just downloaded a file on one of the machines, and it synced over to the other one, at a reasonably fast data rate. The folder I’d put it in, showed syncing on the other machine as I’d expected. As soon as it showed “up to date” the data rate went back to zero, and there seemed to be no change in the out of sync items… So it appears that the machines are connecting to each other fine, and working w/ other files, but not with these out of sync files for reasons unknown…

ex-Gooserider

If possible, please upload screenshots of the GUI from both sides, and also the log files from all the involved devices.

t540-log (6.8 KB) coolbox log.txt (97.4 KB)

Here you go - I hope this is the right stuff…

the two machines are “T540” my laptop, and “coolbox” the desktop machine

Not sure why the log on the T540 is so much shorter - hope it is OK…

Will probably be heading for bed soon, so replies may be delayed…

ex-Gooserider

I’m not an expert, but I personally cannot see anything unusual in the logs. You have tons of folders though. Are the Out of Sync items limited to only some of them, or are they rather spread around all the folders?

If it is the former, then it would probably help to limit the scope to only the affected folders. If you can do this, then please try to remove such a folder, re-add it, and see if anything changes.

Also, when you were adding the folders for the first time, were the files already present on the other device, or were starting from scratch?

On the T540, it says Coolbox has two folders w/ OOS items, on Coolbox it says T540 has 5 folders, two of which are the same on both machines.

I have a such a huge number of folders because it isn’t safe to back up my /home directory, and these are the folders that are in /home (I REALLY want to back up everything, w/ the exception of the few machine specific config files (i.e. monitor specs for the window manager)) Is there a better way to set this up?

This is what I was asking about in one of the earlier messages in the thread (#4?) but hadn’t gotten an answer, so this is what I ended up with.

I had done an earlier install of ST and managed to break it badly by attempting to sync my /home. I thought I had done a ‘scorched earth’ removal of the previous install, and was restarting from scratch. However I believe that the folders I am seeing problems with had been synced during the previous install before things broke.

I will try removing one of the problem folders and putting it back in and see what happens.

ex-Gooserider

There are different approaches. I personally like to have a multi-folder setup like yourself, because this way you have total control over what is synced, and what is not. A different method is to add a whole large folder, and then ignore everything with selected exceptions, e.g.

!/folder1
!/folder2
!/folder3
*

Which approach is better will likely vary depending on the situation, such as the total number of folders and files, hardware performance, etc.

Of course, this is assuming that you have a lot of stuff that you don’t want to sync. If you only want to ignore a few items, then adding a whole folder with a few ignore patterns will be much simpler.

I am having mixed results w/ removing and re-adding folders…

It seemed to help in some cases, but not in others… Now I’m getting an error about inotify limits on the T540, and need to chase down the docs on that (I’ve seen them, just need to find it again) and fix it.

The T540 is down to one folder w/ OOS items, and it is the one w/ the error.

Coolbox is down to 3 folders, one w/ the error, one that I’ve removed and re-added a couple of times (Music), and one (Pictures) I haven’t touched yet…

I had a major mess w/ Music, for some reason (possibly user error) It put all it’s contents into my home directory instead of ~/Music, which made for a lot of cleanup effort to get back to previous state…

However it seems to be making slow progress…

ex-Gooserider

I feel like I am chasing my tail on this, I have now removed and added the problem folders multiple times, and it seems to have gotten rid of SOME of the problem folders, but not others…

On Coolbox, ~/Music seems to be the problem - 13,844 items, 14.7 GiB - However the list only shows 1385 items, which is probably the number of files in that folder.

On T540, ~/Pictures and ~/Reference-docs are the problem files listed 6,293 items, ~4.17 GiB. ~/Reference-docs says 48 problem items, which is a subset of the directory, with a mix of files, subdirs and files in the subdirs. ~/Pictures seems to be a similar mix w/ 625 files - strangely this does NOT add up to the number of files listed as problems…

When I’m looking at the list of bad files on either machine, they are ALL 128 B - so likely “metadata” rather than the actual files…

I also did a spot check of a few of the problem files and they appear to be the same on both machines…

I noticed in the FAQ a section on dealing w/ a corrupted database, the symptoms in that section don’t quite match what I see here, but is that process of deleting the database and making ST regenerate it a possible cure?

Alternatively, where is this metadata stored? Is that a file that can be deleted and regenerated?

ex-Gooserider

This sounds like an issue that I have had recently, but I haven’t been able to reproduce in a clean environment yet. I would bet that those 128 B “files” are actually directories, not files. Can you confirm this?

I have only had the issue when there were pre-existing files on the receiving side though. Could you please try to set one of such folders to Send Only on one side, then remove it (i.e. completely wipe out the files) on the other side, and then try to sync it again? This is the only “solution” that has worked for me here. Once synced properly for the first time, the folders should continue synchronising without any issues.

Mixed on the files being directories…

It is a bit unclear in the ST display just what the OOS items means - The OOS count only shows in the “Remote Device” info section, but does that mean the files are OK on the remote device, and bad on the local one, or vice versa???

In my case, all of the files were originally made on the T540, (at least for now, I’m hoping this will change…)

The Reference-files directory, on both machines, all the “bad” files listed are directories or at least I didn’t see any that weren’t.

For the Music directory it seems to be a mix of files and directories. In doing a more detailed check, it looks like I was mistaken, the OOS items list is NOT all 128 B in size, the items that are files show the about the same size in the list and in Dolphin (difference probably due to rounding)

In addition, probably as a result of whatever it was that caused the contents of ~/Music to get dumped into my home directory, it seems that many of the OTHER subdirs in home ended up getting copied into ~/Music, and those seem to be at least a good chunk of the OOS items.

On the positive side, /Pictures seems to have fixed itself, at least neither machine lists it…

I will give your suggestion a try, probably starting w/ ~/Music after doing the major cleanup I seem to need there…

I have as you suggested, Paused everything on both machines, and removed the Music folder entry from ST on Coolbox, and deleted the entire /Music directory… I then went to the T540, and cleaned up the /Music directory by deleting or moving the non-music directories and files to a new (not synced) directory for evaluation and probable deletion…

I then unpaused ST on both machines… I may not have waited long enough but even though the folder on T540 was set to share, it didn’t try to recreate it on Coolbox. When I tried to recreate the folder on Coolbox, some how I almost ended up putting Music’s contents into the home directory (again). Fortunately I caught this before it had a chance to start syncing files! I then paused both machines, and removed the Music folder entries on BOTH machines, and added it back again to T540 as a new folder. However when I got the request to accept it on Coolbox, it was trying to put it in /home rather than /home/Music… I edited the creation window to fix this and it has been syncing since, and appears to be putting the files in the right place…

One minor thing I’ve noticed, not sure if it is a bug or not, is that in the ST device displays both the local and remote devices show the same upload and download rates at any given moment… It seems to me that if one machine is uploading, the other should be downloading, so the rates ought to be inverted between the two machines?

I THINK I have finally gotten all the folders synced w/o any Out of Sync items showing on either machine, so all seems to be good (at last…)

FWIW, this is what I’ve found seems to work as a procedure…

  1. Decide which machine is the best source, and which will be the “target”
  2. On BOTH running instances of ST, hit “Pause All” under both folders and devices.
  3. On the SOURCE machine, remove the problem folder.
  4. On the TARGET machine, remove the problem folder AND delete the corresponding directory and all it’s contents.
  5. On the TARGET machine create a new empty directory w/ an appropriate name.
  6. On the SOURCE machine, create a NEW folder with the same source directory as in the folder removed in step 3.
  7. UNPAUSE all the folders and devices on both machines.
  8. When you get the message on the TARGET machine about the newly created folder, accept it. VERIFY THAT IT POINTS TO THE DESIRED DIRECTORY!!! Otherwise it may put everything in the Target’s /Home, which will cause a real mess…
  9. Wait for the files to sync over from the source to target…

Hope this helps - ex-Gooserider

2 Likes

I have now gotten all three of the machines that I want to be synced talking to each other and MOSTLY doing the right thing, or so it appears…

However I’m still having Out of Sync item problems… The third machine “Bill-box” is a fairly new machine (for me, I got it as cruft, but had to put a brand new HD in it, so effectively blank), with a Debian Buster install, KDE, Firefox and a few other packages, but I hadn’t done any major data transfers or other work on it.

As I’m entering this, T540 says it is up to date with both Bill-Box and Coolbox. Coolbox says it is up to date with T540, but has 254 items that are NOT in sync w/ Bill-Box… Unfortunately I am not in the same location as Bill-Box at this time, so I can’t see what it says for state.

All of the OOS items are in either ~/Downloads, or ~/Music, and it appears that all are files. They are in different subdirectories of those two, sometimes multiple levels, and the OOS items in any given subdir are a subset of the files that are in that subdir… I.e ~/Music/[artist]/[album]/ might have 15 songs, but only 3 or 4 are shown as OOS.

I have the machines set up as a mesh, where each machine has the other two as remote devices… I based this in part on the forum thread https://forum.syncthing.net/t/best-multi-devices-sync-config/13449/4

It seems that there is a logic problem if A = B, and A = C, but B =/= C :confused:

One of the remaining things I need to figure out is that all of the machines go to sleep when I’m not using them, and it appears they have trouble syncing when they are asleep… It seems nice and “green” to have unused machines using less power, but I need to figure out how to keep them synced when what I am doing is unlikely to have more than one awake at any given time… Possibly setting up a cron job?

I also need to figure out how to keep all the software programs matched, and share some of the data files on things like my calendars and firefox, but that is a separate issue, I’m probably going to have to set up some individual sharing for those items.

ex-Gooserider