# Can't sync to SD card Android 10

**URL:** https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414
**Category:** Android
**Created:** [December 5, 2022, 1:49am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414 "2022-12-05T01:49:19Z")
**Posts on this page:** 9
**Page:** 2

<div class="post-metadata">

### Author: ![arthemis95](https://forum.syncthing.net/user_avatar/forum.syncthing.net/arthemis95/32/13319_2.png) [@arthemis95](https://forum.syncthing.net/u/arthemis95)
#### Post date: [December 6, 2022, 7:28pm UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/22 "2022-12-06T19:28:27Z")

</div>

So I might be stuck using Resilio instead? Because that syncing tool manages write access.

---

<div class="post-metadata">

### Author: ![gadget](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@gadget](https://forum.syncthing.net/u/gadget)
#### Post date: [December 7, 2022, 9:29am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/23 "2022-12-07T09:29:01Z")

</div>

> [@arthemis95](#):
>
> > [@gadget](#):
> >
> > Yes, that’s because it’s Android 10 (or higher) – and the .stfolder was created _by_ Syncthing.
> 
> Oh yeah, totally get that. But at least in my mind you shouldn’t be able to create a folder if you don’t have write access to the directory you are creating it in. So if

Ah… but the key is that the root of the SD card isn’t a regular directory. 😉

Take the following example where the volume label for a SD card is “1234-ABCD”. When the SD card is inserted, Android 10 and up creates a temporary subdirectory under `/storage` using the SD card’s label:

```plaintext
storage/1234-ABCD

```

The path above is then the mount point for the SD card. It doesn’t matter what permissions are on the subdirectory `1234-ABCD` because it’ll be superseded by whatever is applied during the automount.

Android allows an app to create files and folders at the root of the SD card if the app has been granted permissions by user. So VLC could make a subdirectory:

```plaintext
storage/1234-ABCD/Music

```

Likewise, Syncthing could also be told to use the root of the SD card, and if granted access by the user:

```plaintext
storage/1234-ABCD/.stfolder

```

However, it doesn’t mean that Syncthing can now simply come along and copy files into the `Music` folder above because the folder was created by VLC.

> [@](#):
>
> Syncthing can create the .stfolder on the root of the SD card, it has to have write access to the root. Or am I completely missing something and getting insane? But let’s not get too hung up on the “entire root” part, if it worked for folders I created on the SD card root, I wouldn’t be complaining. It would be tedious to set it up for all the folders I wanted to sync, but it would be an acceptable workaround.

Nope, you’re not insane. 😀

Perhaps this will help. Here’s a real-world demonstration on my phone using a terminal app:

 ![image](https://forum-uploads.syncthingcdn.net/original/2X/6/672198d28ec93cc127adc97338ad16151bccb760.png)

In the screenshot above (cropped for size), the shell prompt in the terminal app starts at the root of Android’s filesystem (`/`):

1. I change over to the base storage directory (`cd /storage`).
2. I try to list the contents of `/storage` and I’m denied.
3. Next I change over to my SD card that has the volume label “2FC9-191C” (`cd 2FC9-191C`).
4. Now I’m at `/storage/2FC9-191C` and able to list the contents because my terminal app has “media” access in Android.
5. However, when I try to create a new subdirectory (`mkdir testdir`) I’m denied because I only granted the terminal app permission to access the SD card, not write or modify files. If the terminal app encounters any files and/or folders that aren’t world readable, it’ll also be permission denied.

At the same time, Syncthing has been happily syncing music files from my laptop into `/storage/2FC9-191C/Music`. Syncthing only gets blocked if I try to give it full control of `/storage/2FC9-191C`.

Now let’s take a closer look at the folder ownership and permissions:

 ![image](https://forum-uploads.syncthingcdn.net/original/2X/5/517397581db11cde3a6dd8868cddfbd56b75f866.png)

So users in the “everybody” group are able to read, write and execute files starting at `/storage/2FC9-191C`. Same permissions on all of the top-level subdirectories on the SD card.

But… just when it looks simple…

 ![image](https://forum-uploads.syncthingcdn.net/original/2X/1/174cbe012ccdabac6f8183a33712be4b8fe7bae3.png)

Command “ls -ldZ” above does a “long list of the directory, and not its contents, plus the security context that’s in force”.

In the output above, the string “u:object\_r:fuse:s0” is a SELinux file security context label.

Note how the `/storage/2FC9-191C` mount point has a “fuse” security type. It means that the view of the SD card contents in a file manager app, file picker, terminal app, etc. are all filtered through the FUSE kernel module.

As mentioned earlier, FUSE adds additional security. When combined with SELinux, access to a file/folder can be limited down to a single app, even if the file/folder has “rwx” (read/write/execute) bits enabled for all.

> [@](#):
>
> > [@gadget](#):
> >
> > With Android 10 and up, you can start with a folder at the root (as long as it’s not a system folder). If you take another look at the screenshot I posted, there’s a “Jukebox” folder. I have a few album folders, a music video folder, and so on. I created the “Jukebox” folder with the Material Files app, then when I selected it in Syncthing, Android asked me to grant Syncthing access to it.
> 
> Now this is my issue. This part doesn’t work for me. Neither deleting local files and clearing the cache nor a complete reinstall of Syncthing fixed this, the only folder on the SD Card I can get write access to is com.nutomic.syncthingandroid.
> 
> As you’ve explained, this could very well be an artifact of how Samsung decided to upgrade the S9 to Android 10, meaning that in this specific way my Android 10 behaves more like Android 9, so I have to use the Android 9 workaround documented in the FAQ. Which would be _very_ disappointing, but not necessarily an issue with Syncthing.

If you’re comfortable with a command-line, you could install a terminal app (I like [ConnectBot](https://play.google.com/store/apps/details?id=org.connectbot)) and repeat the steps I described above to get a listing of the permissions including SELinux security context labels.

Post screenshots and it might give enough clues to help fix the problem.

My phone shipped with Android 10 and I upgraded it to Android 11 so my results aren’t going to exactly match yours. Scoped Storage and FUSE weren’t mandatory until Android 11, but they were present in Android 10.

---

<div class="post-metadata">

### Author: ![arthemis95](https://forum.syncthing.net/user_avatar/forum.syncthing.net/arthemis95/32/13319_2.png) [@arthemis95](https://forum.syncthing.net/u/arthemis95)
#### Post date: [December 7, 2022, 10:07am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/24 "2022-12-07T10:07:10Z")

</div>

Oh, yeah I use Linux on my NAS, not scared of a shell, just not exactly running into that many “fancy” file permissions there!

I went with the app that you recommended, and went for it.

This is how it behaves, regardless of if I give the app storage permissions or not.

 ![20221207_110605](https://forum-uploads.syncthingcdn.net/original/2X/8/8dc7f1359c337a16b54512e3a81e2b485713fc0b.jpeg)

Apparently my phone doesn’t use Fuse for the SD card

---

<div class="post-metadata">

### Author: ![gadget](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@gadget](https://forum.syncthing.net/u/gadget)
#### Post date: [December 8, 2022, 4:28am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/25 "2022-12-08T04:28:05Z")

</div>

> [@arthemis95](#):
>
> Oh, yeah I use Linux on my NAS, not scared of a shell, just not exactly running into that many “fancy” file permissions there!

It’s not always easy to tell online. 😀

I’ve worked with people with computer science degrees who almost have a panic attack when they have to use a CLI.

> [@](#):
>
> I went with the app that you recommended, and went for it.
> 
> This is how it behaves, regardless of if I give the app storage permissions or not.
> 
> ![20221207_110605](https://forum-uploads.syncthingcdn.net/original/2X/8/8dc7f1359c337a16b54512e3a81e2b485713fc0b.jpeg)
> 
> Apparently my phone doesn’t use Fuse for the SD card

Yeah, it’s still using the old SDCardFS system – a Samsung creation that was later adopted by Google for Android 8/Oreo (the irony is that Google switched from FUSE to SDCardFS and then back to FUSE again for Android 11).

SDCardFS is its own filesystem while FUSE is a VFS (virtual file system) module that supports all kinds of filesystems including FAT, VFAT, exFAT, NTFS, etc.

Because my Motorola phone was upgraded to Android 11, it ended up with kernel 4.19 while a factory fresh Android 11 phone would be on 5.4. Phones that have Android 11 + Linux kernel version 5.4 are barred from using SDCardFS (the user is told that the SD card needs to be formatted).

This brings up an interesting question… has your SD card been reformatted since you upgraded to Android 10?

---

<div class="post-metadata">

### Author: ![arthemis95](https://forum.syncthing.net/user_avatar/forum.syncthing.net/arthemis95/32/13319_2.png) [@arthemis95](https://forum.syncthing.net/u/arthemis95)
#### Post date: [December 8, 2022, 4:00pm UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/26 "2022-12-08T16:00:58Z")

</div>

> [@gadget](#):
>
> This brings up an interesting question… has your SD card been reformatted since you upgraded to Android 10?

I actually don’t know. I got this phone used, put my own SD card in. So I might actually only ever had used it with Android 10

But I really can’t remember if it already had Android 10 when I got it or not…

---

<div class="post-metadata">

### Author: ![gadget](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@gadget](https://forum.syncthing.net/u/gadget)
#### Post date: [December 9, 2022, 8:01am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/27 "2022-12-09T08:01:16Z")

</div>

The reason I asked is because I’m wondering if reformatting the SD card would help since Android 10 has the updated FUSE system that’s also in Android 11.

I dug out my older phone that has an SD card and is running Android 9 (“Android One” edition, so stock Android with only a few bundled apps from the manufacturer) to take a closer look:

- FUSE is still in the kernel. FUSE is used for OTG (USB On-The-Go) to access USB flash drives.
- SDCardFS is the default format for the SD card.
- I was able to replicate the Syncthing behavior you’re seeing on your Galaxy S9.

Since you’re comfortable with a command-line and Linux, just in case you’re feeling adventurous and have some time to burn… 😉

Google’s AOSP (Android Open Source Project) has been used to create new OS images for older devices. Currently the most popular project is LineageOS ([http://lineageos.org/](http://lineageos.org/)).

Instructions for upgrading a Samsung Galaxy S9:

- [Download and Install Lineage OS 19.1 for Samsung Galaxy S9 and S9 Plus (Android 12)](https://getdroidtips.com/lineage-os-19-galaxy-s9/)
- [https://exynoobs.github.io/OTA/devices/starlte.html](https://exynoobs.github.io/OTA/devices/starlte.html)

After upgrading:

- F-Droid ([https://f-droid.org/](https://f-droid.org/))
- [Syncthing | F-Droid - Free and Open Source Android App Repository](https://f-droid.org/packages/com.nutomic.syncthingandroid/)

A few years ago I upgraded one of my old Android tablets and will eventually upgrade my Android 9 phone to Android 12.

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [December 9, 2022, 8:28am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/28 "2022-12-09T08:28:03Z")

</div>

> [@gadget](#):
>
> Instructions for upgrading a Samsung Galaxy S9:
> 
> - [Download and Install Lineage OS 19.1 for Samsung Galaxy S9 and S9 Plus (Android 12)](https://getdroidtips.com/lineage-os-19-galaxy-s9/)
> - [Samsung Galaxy S9](https://exynoobs.github.io/OTA/devices/starlte.html)

Personally, I’d be very cautious about recommending custom ROMs to someone with no previous experience, especially when there is no official LineageOS support like in this case. XDA downloads are bound to be buggy in some way, e.g. they claim that everything “works”, then after installation you realise that the feature you need is either broken or not available at all. This is true especially with Samsung who aren’t exactly known for their openness and community support which as a result makes their devices difficult to mod. Multiple different models of the “same” device with hardware differences between them don’t help either. There may be some exceptions but I’m just speaking from experience having used a variety of different Samsung phones and tablets for ~10 years or so.

So called “instructions” on how to install custom ROMs that are available on the Internet are also often very sketchy, e.g. the first link talks about using fastboot which doesn’t even work on Samsung devices (which require Odin instead).

---

<div class="post-metadata">

### Author: ![arthemis95](https://forum.syncthing.net/user_avatar/forum.syncthing.net/arthemis95/32/13319_2.png) [@arthemis95](https://forum.syncthing.net/u/arthemis95)
#### Post date: [December 9, 2022, 10:50am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/29 "2022-12-09T10:50:13Z")

</div>

Oh yeah! I used install custom ROMs on all my previous phones! But I decided against using it because even though I spent hours with magisk hide on my A5, I couldn’t get my banking app to work properly, and even just getting Netflix to work was a huge pain…

I think I’ll live with using Resilio Sync instead for this application, since it can write to the SD card (even the root of it) just fine 😅

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [January 8, 2023, 10:50am UTC](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414/30 "2023-01-08T10:50:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Previous page](https://forum.syncthing.net/t/cant-sync-to-sd-card-android-10/19414.md?page=1)
