5

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?

  • Downvote without comment, classic. What is it you don't like? Please at least provide feedback. This is not spam and the question is not already answered. – clst Dec 2 '15 at 10:57
  • Now that you've asked for a feedback I feel compelled to justify my vote. Please read How do I ask a good question? Did you thoroughly search/research for an answer before asking your question? Tell us what you have tried so far and why it didn't meet your needs? // Was it tough to format a blank SD card and then do mount or use some app to find the filesystem in the card. – Firelord Dec 4 '15 at 5:34
  • Thank you for your feedback. Is there a place where we could discuss it? Is the meta the right place? // My motivation was to get someone who did it share his experience without having to format my own SD Card or looking at the Android source code. That worked perfectly and I thought that was the whole point of the SE network. // Of course I used different search tools before I asked (Google, DuckDuckGo, Forums, stackexchange's own search) and came up empty. So I was a bit puzzled when I got downvoted. // I don't think really blank SD Cards are sold anymore. Mine came with exFAT preformatted. – clst Dec 6 '15 at 13:06
  • You can always invite the user to a chat room. If that doesn't work and you think the issue requires community's attention then raise the issue on meta. // Well people has sorts of opinion about SE. Mine is simple: keep a repository of high quality well searched/researched questions and answers. Based on that opinion, I voted your question. As for the search tools, you may consider revisiting your search techniques. The thumb rule is to remember that your query must be organic. // By blank, I meant a SD card with no data of yours. Format it in Android and you can find the filesystem of it – Firelord Dec 6 '15 at 15:20
  • Thanks, interesting. // So, if I understand correctly you only upvote Questions that give the answer? I am afraid I don't understand. I dare you to find the answer to my question using your search techniques. Would you please explain what you mean by organic (is it self-contained)? // Well that is what I was trying to avoid (also with my device the answer is X, does not completely answer it). I will have a look at the Source Code when I get the time to give a definitive answer. However I still fail to see how the Question can be improved. It can be edited so I sure am open to improvements. – clst Dec 7 '15 at 10:55
5

It will format the external micro SD card to FAT32.

  • Thanks. Even the newer version like Lollipop and Marshmallow? – clst Dec 1 '15 at 18:40
  • 1
    Yep, 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. – DukeSilversJazz Dec 1 '15 at 19:25
  • My Galaxy S5 running Android 6.0.1 just formatted a 128 GB MicroSD card with exFAT. – Chris Jenks Apr 30 at 23:00
3

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:

  1. 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.

  2. The ExternalStorageFormatter then uses IMountService to call formatVolume(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.java

  3. This 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.html

  4. NativeDaemonConnector 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-release

  5. formatVol 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. Then Fat::format(devicePath, 0, wipe) is called. (Interesting sidenote: when mounting a volume Android is deleting autorun.inf if it exists: see Volume::protectFromAutorunStupidity())

  6. 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:

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
  • 1
    FAT32. The option -F 32 specifies FAT32. This could be wrong for really old versions though. – clst Dec 7 '15 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. – clst Dec 7 '15 at 15:08

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.