My OnePlus 3 is in a pretty weird situation. I deleted the contents of /sdcard
on an adb shell while my phone was running TWRP via:
# rm -r /sdcard*
I also deleted the hidden files files but they are in a different tar ball than the non-hidden ones and are already restored. For this, I pushed their tar file to my phone and extracted it in an adb shell. However, pushing the substantially bigger tar ball of non-hidden files over to my phone failed.
Upon investigation, I found that apparently /dev/block/dm-0
is mounted both in /data
and in /sdcard
:
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 2.8G 24.0K 2.8G 0% /dev
tmpfs 2.8G 24.0K 2.8G 0% /tmp
/dev/block/sda3 248.0M 272.0K 242.6M 0% /cache
/dev/block/dm-0 52.7G 36.9G 15.7G 70% /data
/dev/block/dm-0 52.7G 36.9G 15.7G 70% /sdcard
The contents of /sdcard
don't make up for 36.9 GiB. It's only TWRP (a few GB) and the hidden folders (about 1 MB).
/sdcard # ls -la
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
drwxrwx--- 5 media_rw media_rw 4096 Aug 1 1970 .
drwxrwxrwt 23 root root 720 Aug 1 1970 ..
drwxrwxr-x 2 media_rw media_rw 4096 Jan 6 00:22 .AzPlugin
-rw-rw-r-- 1 media_rw media_rw 5 Sep 1 14:22 .appodeal
drwxrwxr-x 6 media_rw media_rw 4096 Jan 6 00:22 .estrongs
-rw-rw-r-- 1 media_rw media_rw 72 Oct 19 16:06 .userReturn
drwxrwxrwx 2 root root 4096 Aug 1 1970 TWRP
The weird thing is that /data
– even though the same device is mounted to it – contains a lot of files and folders /sdcard
doesn't:
/data # ls -la
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
drwxrwx--x 38 system system 4096 Jan 5 22:18 .
drwxrwxrwt 23 root root 720 Aug 1 1970 ..
-rw------- 1 root root 2 Aug 1 1970 .layout_version
drwx------ 2 root root 4096 Aug 1 1970 adb
drwxrwx--x 2 system system 4096 Aug 1 1970 anr
drwxrwx--x 107 system system 4096 Jan 5 23:10 app
drwx------ 2 root root 4096 Aug 1 1970 app-asec
drwxrwx--x 2 system system 4096 Aug 1 1970 app-lib
drwxrwx--x 2 system system 4096 Aug 1 1970 app-private
drwxrwx--- 3 media audio 4096 Jan 5 22:13 audio
drwx------ 5 system system 4096 Jan 5 23:10 backup
drwxr-xr-x 2 shell shell 4096 Aug 1 1970 bootchart
lrwxrwxrwx 1 root root 45 Jan 5 22:13 bugreports -> /data/data/com.android.shell/files/bugreports
drwxrwx--x 2 system system 4096 Jan 5 22:13 connectivity
drwxrwx--x 5 root root 4096 Jan 5 22:15 dalvik-cache
drwxrwx--x 245 system system 12288 Jan 5 23:10 data
drwxrwx--x 3 system system 4096 Jan 5 22:13 dpm
drwxrwx--- 3 drm drm 4096 Jan 5 22:13 drm
drwxrwx--x 2 system system 4096 Aug 1 1970 fota
drwxrwx--- 2 system system 4096 Jan 5 22:18 fpc
drwxrwx--- 4 system system 4096 Jan 5 22:13 fpc_images
drwxrwx--- 2 system wifi 4096 Aug 1 1970 hostapd
drwxr-x--x 3 root root 4096 Jan 5 22:13 local
drwxrwx--- 2 root root 4096 Jan 5 16:08 lost+found
drwxrwx--- 35 media_rw media_rw 4096 Aug 1 1970 media
drwxrwx--- 3 mediadrm mediadrm 4096 Jan 5 22:13 mediadrm
drwxrwx--t 39 system misc 4096 Jan 5 22:13 misc
drwxr-xr-x 3 nfc nfc 4096 Jan 5 22:18 nfc
drwxrwx--x 2 radio radio 4096 Jan 5 22:13 oemnvitems
drwx------ 2 root root 4096 Jan 6 00:19 property
drwxrwx--x 2 system system 4096 Aug 1 1970 resource-cache
drwx--x--x 2 system system 4096 Aug 1 1970 security
drwxr-xr-x 2 system system 4096 Aug 1 1970 shared
drwx------ 2 system system 4096 Aug 1 1970 ss
-rw------- 1 root root 11236116 Aug 1 1970 stock_boot_fbcb35a6c03d1c2da5dbb1784d5642fcfda6b4cd.img.gz
-rw-r--r-- 1 root root 100663296 Jan 5 22:15 su.img
drwxrwxr-x 18 system system 4096 Jan 6 00:19 system
drwx------ 2 system system 4096 Jan 5 22:18 theme
drwx------ 2 system system 4096 Jan 5 22:13 time
drwxrwx--x 6 system system 4096 Jan 5 22:13 tombstones
drwx--x--x 2 system system 4096 Jan 5 22:13 user
drwx------ 12 system system 4096 Jan 5 22:13 usf
Why is this?
When I looked for what took the storage space, I found that there are files which used to be on the (emulated) SD card but which I deleted (which is why /sdcard
is so empty) before trying to push the tar ball over to my phone:
/data # du -h . | grep '[0-9\.]\+G'
4.3G ./media/TWRP/BACKUPS/8b32aa5/2016-09-25--16-41-47
4.3G ./media/TWRP/BACKUPS/8b32aa5
4.3G ./media/TWRP/BACKUPS
4.3G ./media/TWRP
4.0K ./media/Android/data/com.google.android.GoogleCamera/files
8.0K ./media/Android/data/com.google.android.GoogleCamera
2.7G ./media/Download
1.3G ./media/MEGA/MEGA Offline/Music
1.1G ./media/MEGA/MEGA Offline/Documents/Uni/Modules
1.2G ./media/MEGA/MEGA Offline/Documents/Uni
1.2G ./media/MEGA/MEGA Offline/Documents
2.5G ./media/MEGA/MEGA Offline
2.5G ./media/MEGA
15.8M ./media/Pictures/9GAG
1.4G ./media/Pictures
1.8G ./media/TitaniumBackup
32.0G ./media
4.0K ./data/com.qualcomm.qti.GBAHttpAuthentication.auth/cache
4.0K ./data/com.qualcomm.qti.GBAHttpAuthentication.auth/code_cache
12.0K ./data/com.qualcomm.qti.GBAHttpAuthentication.auth
4.0K ./data/com.oneplus.GpioSwitch
4.0K ./data/com.google.android.GoogleCamera
12.6M ./app/com.google.android.GoogleCamera-1/lib/arm
12.6M ./app/com.google.android.GoogleCamera-1/lib
12.2M ./app/com.google.android.GoogleCamera-1/oat/arm
12.2M ./app/com.google.android.GoogleCamera-1/oat
47.4M ./app/com.google.android.GoogleCamera-1
3.8G ./app
36.9G .
What can I safely delete? Can I wipe "Data" in TWRP without apps malfunctioning? What happens when I delete the contents of /data/media
? Are those hard links of the files I deleted on /sdcard
?
I pushed that tar ball several times over to my phone, today, extracted it, deleted it, messed up, deleted the contents of /sdcard
, and started over. However, this time, which thus far appeared to be the last time, such weird behavior occurred.
Edit: This question was closed as a duplicate but linked question is entirely different. Just like... Read my question before you close it, please? The linked question is about someone who doesn't know what a symlink is. Mine is about how it can be that data in two locations that have the same device mounted to them can have different contents. The question was closed by someone who doesn't know about symlinks nor about mounting.
/sdcard
is a symlink to/storage/emulated/0
which is a fuse mount of/data/media/0
(emulated sdcardfs with similar characteristics of vfat) - in TWRP simplified/data/media/0
directly bind-mount to/sdcard
(ext4) with fallback/data/media
(in case/data/media/0
doesn't exist) - what is your question please?