Linux - simple way to backup 5 machines

I have 5 machines all using xubuntu in my family and I would like to back up each to my NAS. To date I have been backing up the ‘main’ directories, Documents, Music, Pictures on each. This works fine but for each machine in my syncthing folder list I have 5 x 5 directory identical names except for the individual machine name prefix. It looks messy and unnecessary.

I would like to have a list of just 5 machine names in my folder list. To do this I would need to sync the root folder of each machine. Some 11 directories and 14 files all prefixed with ‘.’ would be synced.

Is there a way to sync the root folders but ignore those .vnc directories and .dmc files for instance? Effectively ignore anything preceded by a ‘.’, including the contents of the directories?

I have read the .stignore documentation but it is ever so complex for my need, however I wonder if there would be any unexpected results for the OS if I were to try this? Would I need some sort or ‘terminating function’.

Something sounds unclear here. In the first sentence, you mention that you’d like to sync directories that begin with .. In the following sentence, you state the you want to ignore all directories preceded by .. Please clarify which of the two you actually want :slight_smile:.

Assuming that you want to ignore all directories in the root folder starting with ., this is what you need to put into your ignore patterns:

/.*

Please keep in mind that the pattern will ignore files beginning with . too (as there is no distinction between files and directories when it comes to ignore patterns).

You also keep using the word “backup” but please keep in mind that Syncthing is not backup software. It does make redundant copies of your data through synchronisation but if you delete or modify a file by mistake, Syncthing will happily push those changes to all connected devices. The same applies if your machine gets hit by a ransomware virus.

1 Like

‘prefixed with ‘.’ would be synced’

means any .directory and .file in both sentences. I don’t see anywhere that I have put ‘…’ but my eyes are getting old!

I want to sync the root folder and ignore any .directoy (and it’s contents) plus any .file

Thank you for showing interest and sorry if I raised a confusion somehow.

Edit: I have just noticed in my reply where I typed ‘.’ it added an extra ‘.’ making it ‘…’ so that would explain what you see but i do not.

Even my edit has been repeated incorrectly with 2 extra ones.

Yeah, so I think you just need to use the previously mentioned /.*. Please test with some temporary folders to make sure that the pattern works first before applying it to your actual data.

I will do that thank you. I assume from your reply that it does not need any ‘termination’ and will only affect the root directory.

Yes, I will certainly test first.

Edit, and yes, backup was the wrong word to use.

Would UrBackup be a better fit for your use case?

Will look into it thank you.

In you first reply your suggested /.* and in your second you suggested /.*.

No, but I see that it may appear like it if you’re not accustomed to the forum formatting. I marked it as code, meaning that it should use a different background colour and a different font than the normal text, but just to be extra clear, the pattern that you need is:

/.*

The leading / means that you target items located in the Syncthing folder’s root path. . combined with * into .* means that it can be any file/folder that begins with a single ..

1 Like

If you are certain that only those explicitly mentioned directories should be synced, then you can invert the patterns. Other things created later that do not start with a dot will then also be excluded.

!/Pictures
!/Documents
!/Video
/*

It tells Syncthing to ignore anything but the lines prefixed with “!”. If you add more of those, make sure to keep them above the last line with the asterisk, as the order matters here.

1 Like

Thank you, it is a good suggestion. As far as I am aware only 5 such folders that I or my family would ever use are placed in the root folder.

I have a question though and that is the placement of the .stignore file. During experiments I find that any file with a ‘dot’ takes its position dependent on the characters following the ‘dot’. This means that it can be placed above the .stfolder and as folders take the highest position in the list, below the folders. I had the impression it needed to be top of the list.

Perhaps this is peculiar to Linux?

The .stignore file MUST be placed in the root of the shared folder.

But I admit that I don’t follow exactly what you mean, so maybe you were wondering something else.

Sorry, it seems I confuse by trying to explain in detail. What I ask is, “Does the position of the .stignore file in the shared folder matter?”

The only valid placement is the root of the Syncthing folder. Is there any reason why you’re not using the Web GUI for adding the ignore patterns? You wouldn’t need to worry about the location that way.

Oh, I missed a main point, thinking it went in the root of the shared folder in question. My bad.

That’s it exactly. I don’t know what else you understood, but this, as you have worded it, is the correct location.

When you share ~/ in Syncthing, the ignore patterns are read from ~/.stignore and from nowhere else. I concur with the recommendation to use the Web GUI for editing the ignore patterns and not worrying about the file location at all.

May I extend my original query in this thread please?

In Linux as I am sure your are aware, there are 5 pertinent directories relating to a user and these can easily be given an 'include ’ only pattern:

!/Pictures !/Documents !/Video !/Music !/Desktop /*

As explained in a post above.

I use Windows 11 rarely but it would be an advantage to me if I were able to sync only the same 5 specific user directories as I do in Linux.

In Windows 11 is it possible to tease out the same 5 pertinent directories and apply a ‘pattern’ to sync only those 5 directories?

Edit: It would appear from research to be impracticable unless the relevant directories are moved to one specific directory and linked back to where they should be. Does that appear to be workable? I know when I was a Windows user, I always moved my relevant directories to another drive/partition.

My use case isn’t the same, but I have each individual directory I want to sync as its own Syncthing Folder.

I too do this in Linux but I was considering changing that to just the top folder with the contents being picked up by syncthing thus reducing the number of sync entries…

May I ask why you chose to sync each one individually?

1 Like

Certainly! TL;DR version: It was easy to do it that way.

My use case is syncing files between a stationary Windows PC and a Windows laptop, both personally owned by me. The stationary PC has a metric boat-ton of storage and is my only machine connected to the cloud backup provider I use.

I have nine shared Folders, seven within my root Documents folder, and two from other locations. My root Documents folder has way more content that I don’t need to sync to the laptop, and it just seemed easier to set up and easier to manage for each directory to have its own Syncthing Folder. It also lets me track each Folder stats individually. Setup effort was very low.