[General Questions and Answers] mbethke:
I'm thoroughly confused about a Portable Storage configuration that I'd like to recreate after switching devices:

I have a Galaxy S5 running LineageOS 14.1 (currently 20180504-NIGHTLY-klte), using a 32 GB SD card as portable storage. Somehow I did something right when setting it up because it's doing exactly what I want: the SD card is writable via MTP, and at least it seems to be encrypted. When I pop the card into another Android device I get a message saying it's not usable on this device. Trying to mount it on Linux fails, although I have no idea what the file system or encryption scheme is. It has two partitions, one 16 MB and one with the rest; neither of them is LUKS nor recognized by any FS I have installed, including f2fs although that what Android says it is:

/dev/block/dm-1 on /mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca type f2fs (rw,seclabel,nosuid,nodev,noatime,background_gc=on,user_xattr,acl,inline_data,flush_merge,extent_cache,mode=adaptive,active_logs=6)

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6)

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6)

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23)

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7)

[...]

/dev/block/dm-1 30G 5.0G 25G 18% /mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media 30G 5.0G 25G 18% /mnt/runtime/default/emulated

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media 30G 5.0G 25G 18% /storage/emulated

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media 30G 5.0G 25G 18% /mnt/runtime/read/emulated

/mnt/expand/d05b94bb-c5af-465d-9b41-8a800e60e1ca/media 30G 5.0G 25G 18% /mnt/runtime/write/emulated

Now I'm trying to replicate that setup on a Galaxy S7 with the same OS (lagging a bit behind currently at 20180419-NIGHTLY-herolte) and a 200 GB card.

At first I decided to try with the ext4fs that I had on the card already. Mistake: the Storage prefs screen says it has 183 GB of internal storage, 160 GB of which are used. Seems the OS decides what's internal ased on FS type while calculating the "used" percentage from the card size and the amount of actual free internal memory. In the details view it shows "system" using 159 GB. Meanwhile, the default "Files" app gets it right and shows both memories separately and with their correct sizes.

Anyway the card wasn't writable via MTP that way and I wasn't able to fix the permissions even though I tried changing the root directory to (ugh!) mode 777 on Linux.

So, new approach: just format it as Portable Storage from within LineageOS and let it use whatever it thinks best. Turns out that is VFAT :eek: Now writing via MTP works ... but VFAT on a 200 GB partition gives me stomach cramps and I'd also like my media to be encrypted. From everything I read on here that's not even supposed to be possible (modulo deep hacks with manual cryptsetup etc.) but somehow it did work on the S5 without me doing anything special. Does anyone have a clue what encryption scheme might be used and how to use it preferably with a decent FS?