Use a different format for sd-card as portable storage (ext3, ext4, extfat)

I was wondering if someone successfully format an SD-card for the FP2 with a filesystem different than FAT32 (the default and also the file system the phone will use when you put in the SD-card the first time).

So of course I’m able to format the SD on my laptop with any different filesystem I would like to have it (e.g. the ones you see in the subject), but as soon as I put it back in the phone it shows that there is an issue with the SD (“Tap here to fix”) and I asks me to format again.

So does anyone have a solution for this?
Can I work around this “Tap here to fix” thing and just mount and use the SD as it is?
I found some other threads where they talk about to modify the /vendor/etc/fstab.qcom. I tested this as well but it did not help me to solve this.

Let me know if anyone has a solution.

Background is that I cannot store files bigger than 4GB on the SD-card, but these files waste up too many space of my internal storage.

(I also read, that it has somehow a ROM and/or Kernel dependency → currently using LOS 17.1 / Android 10 on my FP2)

Yes, I know someone who did and who formatted as ext4, running under an encrypted LOS 17.1. He told me he had needed an additional step before the card would work, I’ll ask him.
Also, ExFat should work, it’s supported by android. I think it had worked for me at some stage.

Thx for your reply - @Alex.A. Would be nice when you can ask your friend.

For me ext4 would be ok as well. Most of the time the sd-card is in the phone. If I really need to read it on another device it will be inserted into a card reader and attached to my own laptop (which is a Linux / Debian system). So ext4 is absolutely fine, but exfat as well. What ever works. :wink:

EDIT: I edited a few things in the post, if you read this line for the first time just read the post again, look for the italic text

Hey, so it’s me :slight_smile:

I have a working ext4 sd card without disadvantages compared to fat32 (the system and all apps recognise it as expected) , it seems that I forgot to document what I did, but my bash history has a good memory luckily.

My fairphone 2 is under Lineage 17.1 and is rooted. That probably won’t work without root.

What it seems I had done, via adb:
The sd card was in the phone, with it’s classical fat32 partition, and unmouted. I think.

EDIT: it seems I found what inspired me: external sd - Cyanogenmod - Filesystem for 64GB SD card, files larger than 4GB - Android Enthusiasts Stack Exchange

First:
adb root

Searching for the sd card’s main partition (take it out, put it back in, and compare the outputs; if you really need to be sure):
adb shell ls /dev/block/

Yay, found it, for me it was “mmcblk1p1”; then we want to turn it to ext4 (this will erase everything on the card and [insert usual warning when messing around with system as root]):
adb shell mkfs.ext4 /dev/block/mmcblk1p1

(then it seems I went directly into the adb shell, no idea what I did and there’s no history :confused: It didn’t last more than 40 seconds, I think it wasn’t significant)

We want somewhere to mount the sd card:
adb shell mkdir /mnt/media_rw/sdcard1

And then I did:
adb shell mount -t ext4 -o rw,noatime /dev/block/mmcblk1p1 /mnt/media_rw/sdcard1

I think I had observed it worked, then I unmounted it:
adb shell umount /mnt/media_rw/sdcard1

And then could just mount it in the system UI

And that seems to be all. I remember I still was in testing phase, and suddenly realising that it just all worked as I was expecting.
My system auto-dectects the sd card, and mounts it everytime, even after reboot, updates, and so. It has a bit of a gibberish name (using the UUID), but that’s all.

There could still be a step missing, but meanwhile this should allow to mount ext4 when you need it :slight_smile:
You could need to do steps 9. and 10. of the stackexchange post for example, my permissions and ownership on the sdcard folder /mnt/media_rw/UUID check out, but I can’t find any trace I did it

Finally, I’m not smart enough to have figured out all this on my own, so it seems I was following some tutorial, but I can’t find it anymore.
I probably found inspiration here, but I’m not sure: https://together.jolla.com/question/40802/how-to-format-your-usd-card-to-share-space-with-android/?sort=votes&page=1
If in the future I find something better from my browser history, I’ll update my post :slight_smile:

Edit: I think I mostly used this post, it’s the same link as at the top:
external sd - Cyanogenmod - Filesystem for 64GB SD card, files larger than 4GB - Android Enthusiasts Stack Exchange

P.S.: I found where the system fstab is I think, but I don’t think I used it, there is nothing corresponding to the sdcard in it; but I could post it if someone wants to compare.
adb shell cat /system/vendor/etc/fstab.qcom

3 Likes

Thx @Ganth,

here is what I just did (for now just with my second Fairphone 2 :wink: ).
(the facts: LOS17.1 / A10; encrypted; no gapps installed; Magisk is installed)

At the end it is just sending commands to the phone via adb (root) shell. So this is a pre-requirement and will not be described here.

The short version / summary:

  1. Find out/verify the block device or more exact the partition of the sd-card (here /dev/block/mmcblk1p1)
  2. umount everything which has something todo with your sd-card (I greped /proc/mounts for the sd’s UUID)
  3. fortmat the found block device to the format you like (for ext4 → mkfs.ext4 /dev/block/mmcblk1p1)
  4. mount the sd-card again (here mount -t ext4 -o rw,noatime /dev/block/mmcblk1p1 /mnt/media_rw/<new folder>)
  5. reboot the phone

The details:
I tried to follow your post, but it did not fully work like this.
At least it was not that easy as expected.

I checked this first:
adb shell ls /dev/block/
and indeed the block device /dev/block/mmcblk1 and it’s first and only partition:
/dev/block/mmcblk1p1
is gone when I remove the sd-card (note this takes a while until the system has realized that you have removed the sd-card … so the first view ls commands it was still visible)

If you try to directly format it with:
adb shell mkfs.ext4 /dev/block/mmcblk1p1
you will fail and you will get something like

this

mke2fs 1.44.4 (18-Aug-2018)
/dev/block/mmcblk1p1 is mounted; will not make a filesystem here!

So I checked several things to understand where it is mounted:
adb shell mount | grep /dev/block/mmcblk1
adb shell cat /proc/mounts | grep /dev/block/mmcblk1
adb shell cat /system/vendor/etc/fstab.qcom | grep /dev/block/mmcblk1

→ no results for all of them

I tried a different approach to find the sd-card mountpoint. With a root file explorer (I currently use File Manager) I saw (and also remember) that my sd-card is visible under the path:
/storage/<cryptical-Nr> while cryptical number is probably the current UUID.
in my case 78D9-1E20

So I searched the mounts again for this UUID:
adb shell cat /proc/mounts | grep 78D9-1E20

As result I saw a lot of mounts:

list of mounts
/dev/block/vold/public:179,65 on /mnt/media_rw/78D9-1E20 type vfat (rw,dirsync,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/mnt/media_rw/78D9-1E20 on /mnt/runtime/default/78D9-1E20 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6)
/mnt/media_rw/78D9-1E20 on /storage/78D9-1E20 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6)
/mnt/media_rw/78D9-1E20 on /mnt/runtime/read/78D9-1E20 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/78D9-1E20 on /mnt/runtime/write/78D9-1E20 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/78D9-1E20 on /mnt/runtime/full/78D9-1E20 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=7)

I was a bit confused a this point. I started to umount everything which has something to-do with my sd-cards UUID. The shortcut here is probably to just umount it via the UI. I did not check this. So I had to execute a lot of adb shell umounts.

After this I was able to format the sd-cards partition.:
adb shell mkfs.ext4 /dev/block/mmcblk1p1
the sd-card of the second phone is just 30GB so it took only a few seconds.

mkfs.ext4 output
mke2fs 1.44.4 (18-Aug-2018)
Discarding device blocks: done                            
Creating filesystem with 7745019 4k blocks and 1937712 inodes
Filesystem UUID: 1b056e2e-6962-4d17-800c-1ca7724cf9a4
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

After that I probably made the mistake, that I mounted it under the very same media_rw UUID path like the vfat (fat32?) formated one.

adb shell mount -t ext4 -o rw,noatime /dev/block/mmcblk1p1 /mnt/media_rw/78D9-1E20

Of course you see it there
adb shell cat /proc/mounts | grep 78D9-1E20
but in the phones UI it had a size less than 1GB.

After I rebooted the phone it has the correct size and automatically get a new UUID which is much longer than the old one adb shell ls /storage/
1b056e2e-6962-4d17-800c-1ca7724cf9a4

The mounts look like

this
/dev/block/vold/public:179,65 /mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4 ext4 rw,dirsync,context=u:object_r:sdcard_posix:s0,nosuid,nodev,noatime,data=ordered 0 0
/mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4 /mnt/runtime/default/1b056e2e-6962-4d17-800c-1ca7724cf9a4 sdcardfs rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6 0 0
/mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4 /storage/1b056e2e-6962-4d17-800c-1ca7724cf9a4 sdcardfs rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6 0 0
/mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4 /mnt/runtime/read/1b056e2e-6962-4d17-800c-1ca7724cf9a4 sdcardfs rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18 0 0
/mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4 /mnt/runtime/write/1b056e2e-6962-4d17-800c-1ca7724cf9a4 sdcardfs rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18 0 0
/mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4 /mnt/runtime/full/1b056e2e-6962-4d17-800c-1ca7724cf9a4 sdcardfs rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=7 0 0

now

So again a lot of mountpoints (6), but I finally have a ext4 sd-card.

I still don’t fully get the connection between the block device /dev/block/mmcblk1p1 which has to be formated and the media_rw path /mnt/media_rw/1b056e2e-6962-4d17-800c-1ca7724cf9a4. Looking to the list of mounts again only the first one mounts a block device (but the it is /dev/block/vold/public:179,65) the rest is just referencing sdcardfs.

If someone is able to explain this relation - thanks in advanced :wink:

Still I will repeat this for my daily driver phone to fix the storage space issue :wink:

1 Like

I was wondering what is the difference between the ext4 format I did on my Laptop in comparison to the mkfs.ext4 via adb shell.

So I checked it via gparted:
Screenshot from 2021-04-01 00-33-06

The difference seems to be the lba flag.

Via Gnome Disks I saw that the flag (is called Partition Type there) is in fact W95 FAT32 (LBA)0x0c.

Hex codes - partition types:
 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux RAID auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1 80  Old Minix

Format version / contents is: Ext4 (version 1.0) not sure if this (the version) matters.

So generally strange that Android is going for a Windows partition type while it is a Linux format.

I re-formated via laptop and tried again.

Sitenote: is that gparted cannot format to extfat (for those who prefer that) and also not set the lba label. I was not able to fix this.
Command gparted is using (click here) …

Command gparted is using:

mkfs.ext4 -F -O ^64bit -L ‘’ '/dev/sdb1’ 00:00:09 ( SUCCESS )
64-bit filesystem support is not enabled. The larger fields afforded by this feature enable full-strength checksumming. Pass -O 64bit to rectify.
Creating filesystem with 7745019 4k blocks and 1937712 inodes
Filesystem UUID: 6d07f8bd-f7dd-482c-98a2-519ded24f290
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

mke2fs 1.44.5 (15-Dec-2018)

Anyway Gnome ‘Disks’ did the job (I went for ext4 + the lba label/partition type → W95 FAT32 (LBA)) .
Of course there are also option in the terminal e.g. via fdisk.

But even the disk looks identical in Disks or e.g. via fdisk -l <your disk/the sd> all my attempts failed. The phone always wants to format it again when I insert it.

I have absolutely no clue what mkfs.ext4 via adb root shell is doing different.

EDIT:
Maybe some very special file system, cylinder-head-sector stuff.
To deep knowledge for me to be honest.

Just saw this difference in expert view of fdisk for the partition table ...

format via adb shell:

Device     Boot Start      End  Sectors Id Type            Start-C/H/S   End-C/H/S Attrs
/dev/sdb1        2048 61962206 61960159  c W95 FAT32 (LBA)      32/0/1 1023/254/63

format via fdisk or Disks:

Device     Boot Start      End  Sectors Id Type            Start-C/H/S End-C/H/S Attrs
/dev/sdb1        2048 61962206 61960159  c W95 FAT32 (LBA)     0/32/33 784/247/6

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

Hey just updated to LOS18.1 and this approach seem not to work anymore :-/

In short the commands:

adb shell cat /proc/mounts | grep storage
#--> get ID if the card here 52D3-1E21

adb shell cat /proc/mounts | grep 52D3-1E21

# umount all mountpoints
adb shell umount <mountpoint>

# format as ext4
adb shell mkfs.ext4 /dev/block/mmcblk1p1

# remount
adb shell mount -t ext4 -o rw,noatime /dev/block/mmcblk1p1 /mnt/media_rw/52D3-1E21

## visible again but as under 17.1 only 1GB size
## -> reboot
## Shows "Issue with <SD card name>"
## no way to fix this except formating again

Any suggestions?

@Ingo vielleicht hier mal noch cross-posten: Filesystem: it's possible ext4 on sd-card? - Using / e / - /e/ community
vielleicht hat da ja noch einer eine Idee.

1 Like

Btw. (a bit off topic, but): My personal reason, why I did this, was/is that there are apps like Signal which grew a lot over the time and so also the backups of Signal are bigger than 4GB. So I cannot safe the backup (and there are 2 files - no option right now do change this) on the external SD, even it is encrypted. :man_shrugging:

Looks like that someone developed a way that the backup will be split into 1GB chunks.

Not sure what needs to be done that this will be accepted and done (the PR merged) by the Signal App Devs.

That’s exactly the point where I also need help :). My Signal backup is larger than 4 GiB and I can’t used anything other than FAT32 for the external SDCard :-(.

Singu

Did you guys try to format in exFAT? It’s not officially supported by android, but IIRC it works on the FP2 and doesn’t require all the hacking ext4 needs. And it supports much larger files.

Not yet and I switched to FP4 with CalyxOS.

The FP4 has much more space, so this issue does not exist anymore for now. Even though I think a lot can go to the external SD (downloaded maps, downloaded Spotify songs; anyway encrypted stuff like messenger backups, Neo Backup files, etc.).

@Singulus I also took part of this github dicussion, which would help a lot, at least in regards of the Signal big backup files issue. But it seems to take ages until the Signal devs accept such external PRs. :frowning: introduce chunked backups by Roghetti · Pull Request #11900 · signalapp/Signal-Android · GitHub
If you have a github account, maybe a comment there, that you need that, would help or push this and/or like Roghetti’s posts.

@Alex.A ok, exFAT might be an option, as it seems that I have to re-fomat the external SD for my FP4 anyway (I just moved it from the FP2 to the FP4 and it acts strange and is not read-/writeable for some apps - but potentially it has another problem or is broken in general).
What to you mean that is does not need the hacks? Is it just formating with the PC? Will it be accepted by Android without re-formating?

1 Like

AFAIK yes. I can’t find a spare SD card to test now, but if you can, it should.

Hm this would be surprising if this is working, as I wasted a lot of time make ext4 working ^^ (as we can see in this thread). Anyway currently trying with my old FP2 and an older small 32 GB SD Card (I erase and format it with my PC to exFAT) … will report back.

Nope doesn’t work. Android asked for re-formating also with an extFAT SD card.

2 Likes

Just formatted an old 8GB Sandisk to exFAT via Win11

  • Moved to FP3 with A.0016β no query

  • Close and open phone, prompted to ‘Set up’ SD card

  • Select ‘Use as portable’

  • Discovered photo not saved to SD card using default camera app

  • Under storage the SD card is seen as ‘disk’ not *SD card and all the ‘Android’ folders have been created.

  • Reinsert in PC > still exFAT so clearly the phone can write to the SD card as it has created the folders.

  • Transferred video whilst in PC, plays on FP3 fine.

  • Can’t use ‘disk’ as storage location using default or Open Camera.

  • Can move files manually from FP3 to ‘disk’

Restarting Phone

OK now Open Camera is saving to ‘disk’ :slight_smile:

  • Default camera still ignores option to save to SD and reverts to phone. This was a problem earlier and I wonder if there is a regression in the 0016β
1 Like

For me this was NOT the case, neither with exFAT nor with F2FS nor with ext4. One FS seemed to be recognized but it couldn’t be accesses as it seems read-only.

1 Like

I opened a bug report for LineageOS, which is ignored until now:

2 Likes

Okay, my bad then, it may have been too long ago if the change (as you mention in your issue @Singulus) is recent.