I was wondering what file system Android will use when I format my (external) SD Card. Can someone enlighten me?
Is it the one already used or exFAT or FAT32 or manufacturer dependent?
2 Answers
It will format the external micro SD card to FAT32.
-
-
1Yep, I just formatted my Verizon LG G3's external sd to troubleshoot an issue, and that's the case (it runs Android 5.1). You may be able to format it outside of the device to NTFS or exFAT, but whether or not your device will read it correctly depends on the device manufacturer. Commented Dec 1, 2015 at 19:25
-
My Galaxy S5 running Android 6.0.1 just formatted a 128 GB MicroSD card with exFAT. Commented Apr 30, 2019 at 23:00
TL;DR: Every Android uses FAT32. The Cluster size depends on the release. Existing partitions will be preserved. It will always use quick format.
Long Answer: After some more research here is the process as it was coded in the Android source code:
The Setting App displays a few confirmations then uses the Intent:
Intent(ExternalStorageFormatter.FORMAT_ONLY)
in 4.4 KitKat: https://android.googlesource.com/platform/packages/apps/Settings/+/kitkat-release/src/com/android/settings/MediaFormat.java
in 5 Lollipop: https://android.googlesource.com/platform/packages/apps/Settings/+/lollipop-release/src/com/android/settings/MediaFormat.java
in 6 they changed this. I will have to look more into it.The ExternalStorageFormatter then uses
IMountService
to callformatVolume(extStoragePath)
in 4.4 KitKat: https://android.googlesource.com/platform/frameworks/base.git/+/kitkat-release/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java
in 5 Lollipop: https://android.googlesource.com/platform/frameworks/base.git/+/lollipop-release/core/java/com/android/internal/os/storage/ExternalStorageFormatter.javaThis function calls
mConnector = new NativeDaemonConnector(this, "vold", MAX_CONTAINERS * 2, VOLD_TAG, 25); mConnector.execute("volume", "format", path);
in 4.4 KitKat: https://android.googlesource.com/platform/frameworks/base/+/kitkat-release/services/java/com/android/server/MountService.java
in 5 Lollipop: https://android.googlesource.com/platform/frameworks/base/+/lollipop-release/services/core/java/com/android/server/MountService.java
more info about vold: https://source.android.com/devices/storage/config.htmlNativeDaemonConnector
finally calls the native function to format the partition:Volume::formatVol()
This call is without a Volume Label and does not wipe the partition.see Volume.cpp, VolumeManager.cpp, CommandListener.cpp
in 4.4 KitKat: https://android.googlesource.com/platform/system/vold/+/kitkat-release in 5 Lollipop: https://android.googlesource.com/platform/system/vold/+/lollipop-releaseformatVol decides wether to format the partition (if one already exists) or the whole device (see
int Volume::formatVol(bool wipe)
). When the latter is the case a new MBR is written. ThenFat::format(devicePath, 0, wipe)
is called. (Interesting sidenote: when mounting a volume Android is deleting autorun.inf if it exists: seeVolume::protectFromAutorunStupidity()
)- in Fat::format (in Marshmallow it is named Vfat) the actual formatting is done with:
/system/bin/newfs_msdos
. The parameters are different depending on the Android release, number of sectors is always omitted, wipe is always false:- Lollipop and Marshmallow: -F 32 -O android -c 64 -A
- Kitkat: -F 32 -O android -c 8
- other systems might differ, see: https://android.googlesource.com/platform/system/vold/ /Fat.cpp or Vfat.cpp
Appendix: /system/bin/newfs_msdos syntax from https://android.googlesource.com/platform/system/core/+/lollipop-release/toolbox/newfs_msdos.c :
usage: newfs_msdos [ -options ] special [disktype]
where the options are:
-@ create file system at specified offset
-A Attempt to cluster align root directory
-B get bootstrap from file
-C create image file with specified size
-F FAT type (12, 16, or 32)
-I volume ID
-L volume label
-N don't create file system: just print out parameters
-O OEM string
-S bytes/sector
-a sectors/FAT
-b block size
-c sectors/cluster
-e root directory entries
-f standard format
-h drive heads
-i file system info sector
-k backup boot sector
-m media descriptor
-n number of FATs
-o hidden sectors
-r reserved sectors
-s file system size (sectors)
-u sectors/track
-
1FAT32. The option -F 32 specifies FAT32. This could be wrong for really old versions though.– clstCommented Dec 7, 2015 at 15:01
-
Just looked at it. Even Donut (Android 1.6) used this. Donut also had support for formatting ext2 apparently though. // EDIT: Apparently the comment I was replying to has vanished... So it looks weird now.– clstCommented Dec 7, 2015 at 15:08
mount
or use some app to find the filesystem in the card.