Thursday, December 10, 2015

external sd - Why is the SD-card mounted to "/sdcard/external_sd" instead of "/sdcard" (or "/mnt/sdcard")?


I recently upgraded my phone to an LG Motion 4G (Android 4 ICS). I see that the sdcard is mounted at /sdcard/external_sd. I also noticed that this appears to be the same with some other newer models. Apps expect the sdcard to be at /sdcard. I assume the manufacturers want to include a lot of internal storage, but why mount internal storage at /sdcard? Shouldn't this be against some form of Android specification standard?



Answer



The reason is the history of Android: The first generation of Android devices only had a small amount of internal storage (around 100-400MiB) which was mounted under /data.


Next, devices with a, at that time external, SD-card came out. The SD card was mounted under /mnt/sdcard.


After that, devices with large internal storage came on the market. This storage was portioned, because /mnt/sdcard had become the default place for big data chunks from apps, pictures and such. So the Android environment had to have a /data and /mnt/sdcard directory. Therefore one partition was for /data, the other for /mnt/sdcard. This is the reason why you storage space could become low (the /data partition) even if there is plenty of space on /mnt/sdcard.


This situation was improved with Android 3.0: /data and /mnt/sdcard are now pointing to the same partition. Good job Google, that could have been done versions ago. Which is also the reason why app2sd is no more needed on Android 3.0 or higher: You would only move the data within the same volume.



Now we come to the answer if your question: Since /mnt/sdcard is already mounted on the internal storage, an external SD-card has to use a different mount point. And this mount point is not specified by Google. It could be



  • /mnt/sdcard/ext_sd

  • /mnt/external

  • /mnt/extSdCard

  • /mnt/sdcard/external_sd

  • etc.


The API call getExternalStorageDirectory() usually points to the internal storage directory. This behavior is documented. There are open source projects that provide tools to find the external SD-card directory in a canonical way.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...