4

My phone doesn't support removable SD card.

  • When I open Titanium Backup app on my rooted Oneplus One (CM12), I see (at the bottom) in the Overview few specs including System ROM usage and Internal+Media which says 58.9GB (10.7 GB free).

  • In ES File Explorer I see similar free space.

  • In DiskInfo, I see under Data:

    • Used: 45.8 GB,
    • Free: 10 GB,
    • Mount point: /data,
    • Filesystem: ext4,
    • Partition name: userdata,
    • Partition nickname: Data, among other things
  • Diskusage went further and showed under Storage card:

    • Media: 42966 MiB
    • Apps: 3001 MiB
    • Free space: 10262 MiB
  • Settings -> Storage says that total space is 54.92GB and Available is 10.02GB.

All of the above info makes me conclude that my apps and app data, and other personal files are all stored in one single partition named Data at /data.

But mount says that:

/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,errors=panic,data=ordered 0 0

/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,noatime,nodiratime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0

I also saw this emulated term under /storage and it seems related.

Question: I mentioned all of the said info because I don't understand, if my Media (personal files) is under /data then why Recovery doesn't wipes it as default unless I explicitly choose /data/media to do so. In case of fastboot, I can delete all apps+media using fastboot erase userdata, but why Recovery and Android treats it as different?

More so, how does Recovery even wipes it then?

Also, what was /dev/fuse in mount's output and if they all are one single partition then why I cannot go up level beyond what is shown as home directory or Internal SD card or 0.

1

Well this sdcard thingy is kind of tricky for the OPO. For me it seems like the device does not have an sdcard at all(not even an internal). Which would mean that the free space you see is actually an emulated internal sdcard taken from your device flash memory.

For emulating an sdcard a FUSE daemon is used where also your /dev/fuse device comes into play. This is probably the raw presentation of your flash memory made accessable via your kernel. Which is then mounted to /mnt/shell/emulated.

Additional Info about FUSE: http://en.wikipedia.org/wiki/Filesystem_in_Userspace#Virtual_file_system.

To back my assumptions about the emulated internal storage see the storage configuration file for the OPO: https://github.com/evolve-bacon/android_device_oneplus_bacon/blob/lollipop-5.1/overlay/frameworks/base/core/res/res/xml/storage_list.xml

Now to your question why your /data/media directory is not wiped while doing a factory reset:

This is just a nice feature when there is no physical external sdcard(or even internal) present. So that you don't loose your important userdata like downloads pictures etc with a data wipe.

What Cyanogenmod did here was declaring an external sdcard on your emulated internal sdcard which resides in /data/media.

For full understanding see: https://github.com/TheOldUnas/Bacon-Lollipop-Boot/blob/master/boot/ramdisk/init.bacon.rc

Especially the declaration of: export EXTERNAL_STORAGE /storage/emulated/legacy and the FUSE daemon for /data/media: service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated

For final understanding compare on youe device the output between ls -l /data/media/0 and ls -l /storage/emulated/legacy and finally ls -l /sdcard. It is all the same as it is your from emulation, emulated external sdcard :D

For your comparsion between fastboot erase and data wipe through android/recovery. Fastboot is part of the bootloader and does not know about all this emulation mess so it will completely wipe data.

  • It means that the app data and the media all belongs to one partition named userdata and perhaps that's why fastboot erase ends up deleting all of that said data. Isn't it? – user109933 Jun 12 '15 at 19:37
  • yes you got it exactly right. – divided-by-zero Jun 13 '15 at 22:47
  • is there anything not clear to you according your questions? If yes please ask so i can clarify it. If not please accept this answer as I put quite much effort in explaining everything as detailed as possible. – divided-by-zero Jun 16 '15 at 7:41
  • +1 for covering all the points and I'll accept it after one clarification. How does a custom Recovery clears Data when I tap "Clear Data" and how does the Recovery not ends up deleting "/data/media" unless explicitly stated? – user109933 Jun 20 '15 at 10:37
  • this is highly dependant on the implementation of the recovery. some really basic recoveries do not handle emulation(probably they have no fuse daemon inbuilt) so they just fully wipe the whole partition. some are recognizing the EXTERNAL_STORAGE declaration and have a different wiping implementation for such cases. – divided-by-zero Jun 20 '15 at 11:15
0

Answer to your question "More so, how does Recovery even wipes it then?" /data/media is just a link Wiping /data is for if you install a new rom etc and if you would also wipe /data/media, there might be rom install zip-s, so it's either because of link or security

  • How to wipe a folder ? I know how to wipe device only – ransh Apr 12 '18 at 15:50
  • Go to a folder and delete it – rebane2001 Apr 13 '18 at 16:42

Your Answer

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