Hey everyone, I’ve been using Syncthing for a while now, and in the past I have been able to backup my entire Android devices with a single Syncthing folder. However this is not possible in the latest version(s) of Android as apps don’t have access to the parent folder of the device, and so to sync the whole device now requires manually selecting each folder within the parent folder and syncing them. On my current phone I have 20 folders in the parent folder, most of them created by the OS or apps I’ve installed, and even if I manually set up a Syncthing folder sync for each of them, I would still need to check from time to time in case any new folders have been created, and again sync them. It might seem like overkill to backup everything, but I’d rather have everything backed up and not need it, than have something happen to my device and then find out that a folder wasn’t synced that I would have liked.
So, my suggestion is to add a feature as a workaround to this Android limitation that allows all the folders in the parent folder of the device to be added to a single ‘folder’ for the purposes of syncing to another device. The Syncthing GUI at both ends could then show a single folder being synced, but the whole device would be synced, as it used to be. This would be a great convenience for those of us who want to backup everything on our devices without having to set up a sync every single folder manually. Ideally, notifications would also be sent whenever a new folder is created in the parent folder, so that this folder can also be added easily (I assume that some user confirmation would be required by Android for each subfolder that is synced within the parent folder).
Hopefully that all makes sense. I don’t know what the process is for new features being added but I hope we can see a workaround like this implemented in future. Keen to hear if others would be interested in this or if I need to clarify anything. I did do a quick search of the forum before posting and I couldn’t see anything along the lines of what I’ve suggested.
I’m on Android 13 (GrapheneOS) and I’m synching my parent folder. Added the directory /storage/emulated/0 as the folder (the dropdown screen is annoying; and hod to do some blind typing but if you are able to click away from the main screen it stays as the parent directory.)
I think you might need to enable Advanced Folder Picker in settings; but its working for me.
Thanks for the reply, and sorry for my slow response. I’m wondering if it’s because of root, or your custom ROM that you’re able to access it? I checked and I already had Advanced Folder Picker enabled, and I also tried the web GUI which let me type the exact folder path I wanted, but once it was set up it said access denied. My understanding is that Android by default doesn’t allow apps access to this parent folder. Can anyone else with an unrooted device confirm this? Or does anyone have a workaround that doesn’t require root? I am trying this on a Samsung Galaxy S22 Ultra and a Google Pixel 7, and neither let me sync the parent folder of the device.
I have Syncthing backing up select subfolders, not the whole device.
If you want to back up your whole phone, you can do it with an SSH server (free from Google Play) and any SFTP sync app. I use FreeFileSync and Winscp, both free. The SSH server to use is called “SSH/SFTP Server-Terminal” from Banana Studio.
Thanks for the suggestion - I’ll look into it. Do you know why this method would have full access to the phone’s parent folder when Syncthing doesn’t? Just curious, but happy to try anything that does the job.
On Android, user data is normally stored under the directory path /storage/emulated/0. That’s where you’ll find subdirectories such as the following:
When adding a new Syncthing folder and pointing it at /storage/emulated/0, Syncthing will try to create its marker folder (/storage/emulated/0/.stfolder), but Android’s security system restricts write access to /storage/emulated/0, resulting in Syncthing reporting that it doesn’t have permission.
So it’s not that other apps such as Banana Studio’s “SSH/SFTP Server-Terminal” have better access to the data storage on Android than Syncthing, it’s that those apps don’t have the same data safeguards as Syncthing does.
Short of rooting your Android device, the trick is to treat /storage/emulated/0 as though it were read-only (Syncthing FAQ: How do I serve a folder from a read only filesystem?). With the proper permissions, Syncthing will still have access to read/write into the subdirectories (e.g., /storage/emulated/0/DCIM, /storage/emulated/0/Documents).
Thanks for the replies and explanations guys. That makes sense. Strangely my /storage/emulated/0 already has a .stfolder folder in it, but I still can’t sync it. I’m going to look into the read only option first, and then the SSH server option. I did used to root my devices but don’t any more for a few reasons, so I’ll see how I go with the above.
I use SSH server not only for backing up folders on my cell, but for Linux and Windows too. Open SSH Server is free on Windows/Linux/Mac. FreeFileSync can back up anything capable of SFTP which is what SSH provides.
Inside FreeFileSync you can create a “job”. Once set up, you just run it whenever you need to. my backup drive remains connected to 1 computer and I back up all of my other computers via SFTP and some of them are windows and others are Linux, cell, tablet.
Additionally, if you load SSH server on each of your Syncthing servers you can use it to create a secure tunnel for accessing the management Gui that normally only runs locally on each server.
Thanks, it sounds like that’s the way to go. I quickly looked into changing the Syncthing marker folder on Android but could see any settings for it, or files on the device anywhere to configure. I’m sure it’s there somewhere but the SSH server now sounds easier. I’ll install the Banana Studio app and FreeFileSync when I get a chance and go from there.