5

I can't find an answer to this on StackExchange. I have a phone running beta LineageOS 14.1 (Android 7.1), and a 128GB SDXC card which I want to use as portable/shared storage between devices.

I know that the built in Settings -> Storage -> "format SDcard" chooses a default file system (FAT32 with large clusters or exFAT?), but if I wanted to, could I manually format the card via Terminal to use a proper journalling file system for better data safety?

If so, what file systems could I use and what would the appropriate commands be? Would there be any other benefits or disadvantages? Would it still be portable or would I have to do something to stop ACLs/permissions being set up by default that would prevent it being swapped to other devices?

Update

Regarding comments below, it sounds like more context would help.

I'm not looking at NTFS/apple NFS as other file systems. My main "other devices" for portability would be other Android 5.1+ devices and Windows 8.1/10 (via microSD USB adapter). I'm comfortable that Windows would need an ext2/3/4/other driver or to host a Linux VM in order to read or write a microSD card that isn't in FAT* format. (I'm much more comfortable about adding ext* handling to a Windows machine than to add NTFS capability to Android, and its also simpler and less likely to give me problems because Windows would only need to access it for file management/copying, not via multiple apps of various generations on Android)

The point underlying the question is that portable storage uses FAT32/exFAT by default, without offering alternatives, and these don't have any especial data integrity provisions such as journalling, that would be integral to (and included by) several other file systems.

So its a natural question whether, by using a different file system from the default - which would of course require manual formatting and perhaps manual permissions setup - I can get the effect of universal read/writeability and portability (as with FAT*), but also gain in addition, enhanced integrity via journalling in case of crash or other data issue, which FAT* doesn't provide.

  • If the other devices support it, EXT4 would be your best choice. Keep in mind that, as you thought, permissions will be messy at best, so you would have to edit them to be world readable-writeable-executable quite often (bad practice and security flaw). If you want to play it safe, go for FAT32, but mind that the maximum file size would be 4GB-1. Lastly, if you are brave and believe that all your devices might support it, you could give NTFS a try. – Death Mask Salesman Feb 11 '17 at 11:37
  • No easy option to get a journalling FS without permissions chaos or a lot of work, then? – Stilez Feb 11 '17 at 14:41
  • @DeathMaskSalesman Are you sure to recommend FAT32 for so large a storage? FAT32 is a quite bad idea for volumes of 32GB or up in size. Instead I recommend exFAT because any system that supports volumes larger than 32GB must also support exFAT as well. – iBug Feb 12 '17 at 2:47
  • @iBug Well, if exFAT is supported by many devices, then why not? Do you plan to add it as an answer? – Death Mask Salesman Feb 12 '17 at 4:03
  • @DeathMaskSalesman I have no idea of adding an answer. The OP didn't tell us what devices he'd like to share data among. There's so much to discuss that I think it's unnecessary. – iBug Feb 12 '17 at 9:20
2

If 'journaling' is a requirement, then the EXT family (preferrably ext4) mighy be your only choice. Otherwise exFAT is the best. Just FYI, data safety depends more on your hardware rather than software (assume there's no malware), including filesystems. Any FS on a bad drive fails, and any FS on a good drive makes few differences.

It is definitely sure that if you format it to ext4, you'll have to frequently chmod -R 777 and chown -R 0.1028 (which is actually root:sdcard_r) to ensure apps work fine. Different apps have different UIDs & GIDs and upon creating a file, the owner groups are set as the app's U&G, while permissions are set according to the effective thread's umask.
Another notice is that Linux ACL is not supported by Android, whereas SELinux is, which can cause.
The FAT family is better for not having permission support, thus preventing "permission chaos" from happening. exFAT is my personal preference for shared storages. There's no regular maintenance required.
Since you're asking here, an Android community, I'm not going to discuss NTFS & Apple's HFS as they can hardly be recognized by a common Android device. Of course you can add the support for those by yourself, but it's mainly a concern of developers.

2

Stock android only supports mounting FAT32 drives as portable storage if mounted system-wide (r/w). Supported partitions may vary depending on device to device. Its dependent on manufacturer/customized Rom maker to provide system-level drivers for volumes of different formats.

As your are using lineage OS (cm fork) it might be provided. And in case it isn't can be easily configured (recommended-the busybox way). I wouldn't have liked to go for journaling, permission-oriented filesystems.

For external SD, I focus on accidental deletions mostly on my media and documents, so TestDisk (free command line utility) works to "Undelete Files" from old index tree with ease. Very useful.

For the partitions, to keep it simple, I like to have the following partitions and configure on all my removable drives.

an FAT32 (~75% of size) (mountable on all - desktop, phone, tablet, smarttv, router, nas)

and exFAT(~25%) (on External HDDs I use TrueCrypt to encrypt this volume) (big files - mountable on PC's (Win/Lin/Mac) and Android (atleast in ES File Explorer (an app supporting exfat) and on my Sony AndroidTV (manufacturer-provided-drivers)) and rooted nexus 7 supports it)

You may allow android to create a partition as adopted storage depending on needs. See this link for mixed partition formats while using adopted storage (Semi-Adopted storage).

Apps can ask for access to storage and mount the external drives within their own context (mount point not shared with other apps). There are apps supporting ExFat, NTFS, AFS, HFS+, and even truecrypt/bitlocker encrypted partitions. All this is suitable for external connections, since an SD card would be required to mounted almost all time and accessible across.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.