How disk space is used on Android device? I have critical low storage level and can't understand what takes much of it and how that's possible that the installed applications can use 7 GB? I only use a few social media clients without any games or soft like Photoshop. Also on the second screenshot it indicates that the apps are using just 1.13 GB and so I can't understand the situation. Also what is the "Other"?
Android's filesystem hierarchy is a bit complex and people often find it difficult to grasp. A major reason for confusion is that Android isn't very expressive in explaining these things and it's not very clear which files Android put in which category. Another reason is that mostly devices are not rooted and users don't have access to filesystems to verify the things themselves. We can try to understand it from root.

VIDEOS, PICTURES, AUDIO AND "OTHER":

Android uses file extensions to decide if a file in Public Shared / External Storage (i.e. /sdcard excluding the private directories of apps) is video, picture or audio. This header file defines a mapping between file extensions and categories. Further details can be found in this answer.

Simply put, we can use file extensions to categorize files and calculate their size:

~$ find /sdcard/ -type f ! -path '/sdcard/Android*' | grep -iE '\.3g2$|\.3gp$|\.3gpp$|\.3gpp2$|\.asf$|\.asx$|\.avi$|\.dif$|\.dl$|\.dv$|\.fli$|\.lsf$|\.lsx$|\.m4v$|\.mkv$|\.mng$|\.mov$|\.movie$|\.mp4$|\.mpe$|\.mpeg$|\.mpg$|\.mxu$|\.qt$|\.ts$|\.vob$|\.webm$|\.wm$|\.wmv$|\.wmx$|\.wrf$|\.wvx$' | xargs -I {} du -b '{}' | sort -n | awk '{sum += $1} {print} END {print sum}'
...
75696063        /sdcard/DCIM/Camera/VID_20190726_190531.mp4
97849262        /sdcard/DCIM/Camera/VID_20190721_142818.mp4
331238039       /sdcard/TIMELAPSE OF THE FUTURE_ A Journey to the End of Time (4K).mp4
1554180683


So I have 1.55 GB of videos on my /sdcard.

~$ find /sdcard/ -type f ! -path '/sdcard/Android*' | grep -iE '\.art$|\.arw$|\.bmp$|\.cr2$|\.dng$|\.gif$|\.jng$|\.jpe$|\.jpeg$|\.jpg$|\.nef$|\.nrw$|\.orf$|\.pbm$|\.pcx$|\.pef$|\.pgm$|\.png$|\.pnm$|\.ppm$|\.psd$|\.ras$|\.rgb$|\.rw2$|\.srw$|\.svg$|\.svgz$|\.tif$|\.tiff$|\.wbmp$|\.webp$|\.xbm$|\.xpm$|\.xwd$' | xargs -I {} du -b '{}' | sort -n | awk '{sum += $1} {print} END {print sum}'
...
31944   /sdcard/.recycle/1565980569828.3/2080952923/Screenshot_20190816-155104_Firefox.png
34099   /sdcard/OLD_sdcard/Download/iptables_overview.jpg
6839118 /sdcard/DCIM/Camera/PANO_20190421_132245.jpg
7726000 /sdcard/DCIM/Camera/IMG_20181123_144811.jpg
669063808


And 669 MB of pictures. Combined with videos it becomes 2.22 GB.

~$ find /sdcard/ -type f ! -path '/sdcard/Android*' | grep -iE '\.aac$|\.aif$|\.aifc$|\.aiff$|\.amr$|\.awb$|\.flac$|\.gsm$|\.m3u$|\.m4a$|\.mka$|\.mp2$|\.mp3$|\.mpega$|\.mpga$|\.oga$|\.ogg$|\.pls$|\.ra$|\.ram$|\.rm$|\.sd2$|\.snd$|\.wav$|\.wax$|\.wma$' | xargs -I {} du -b '{}' | sort -n | awk '{sum += $1} {print} END {print sum}'
...
196556  /sdcard/OLD_sdcard/Alarms/Freedom.ogg
451614  /sdcard/OLD_sdcard/CallRecordings/0507189091_190225_191938461.amr
5652322 /sdcard/.recycle/1564398739475.3/710629278/L'Orfeo(preview).mp3
186868393


And 187 MB of audios. Now total space taken by files:

~$ du -bs --exclude=/sdcard/Android /sdcard/
5330784600      /sdcard/


It's 5.3 GB. Subtracting video, pictures and audio, it's 2.89 GB which is the size of "Other"; shown as "Files" on my device:





Non-root part is over here. Next to explore /data you need root access. First to make clear, throughout the whole life of device, a common user interacts only with one partition labeled userdata. But it's not very uncommon to have 50+ partitions on Android devices. Details can be seen in this thread. So we are talking about the space usage on userdata partition which is mounted at /data. One of its sub-directory /data/media/0 is the one we see in file explorers or at /sdcard or at /storage/emulated/0. See What is /storage/emulated/0? for details.

TOTAL SPACE USAGE:

Now have a look at space usage reported by Android. It says 16.73 GB out of 32 GB are used. Let's analyze.

~# cat /sys/block/mmcblk0/size 
61071360
~# df -B1 --output=size /data
  1B-blocks
25762942976


Note: Don't confuse units. 61071360 sectors equal 31268536320 bytes, which equal 31.27 Gigabytes (GB) or 29.12 Gibibyte (GiB).

Total available size of eMMC is 31.27 GB (ignoring e.g. RPMB and provisioned space etc.) and size of /data filesystem is 25.76 GB (See! I thought it would be 32.00 GiB). It means 5.5 GB space was occupied when device was shipped from factory. It's mainly taken by system, vendor and cache, and a small part by other partitions. Partition table takes a few KBs but there are possibly a few MBs left free in between partitions, some space is wasted due to encryption, and so on. Following screenshot shows the complete partition table:


(Click image for enlarged view)

Now coming to used space:

~# df -B1 --output=used /data
       Used
10407436288
~# du -b -d1 /data | sort -n
...
30932548        /data/system
89343105        /data/user_de
252376438       /data/dalvik-cache
1537995332      /data/app
1817762284      /data/data
5460784600      /data/media
9250761612      /data


Space usage reported by filesystem is 10.4 GB, while the apparent size of files is 9.25 GB. This difference of 1.15 GB could be variable and is used by the filesystem. Details can be found in this answer. May be a part of it is being used by f2fs log structure on my device.

So total used space on device is 15.9 GB (5.5 and 10.4) out of 31.27 GB. Note the difference with values in screenshot. The difference in total size could be because of rounding-off the sum of /data and /system to nearest power of 2.

APPS SPACE USAGE:

5.3 GB out of 9.25 GB is used by public files in /sdcard as explained above. Rest of the 3.95 GB space is mainly taken by three categories of files. Keeping things simple, following are the major directories which sum up to total app size (1, 2, 3, 4):

App size    /data/app/&lt;pkg&gt;*
            /data/dalvik-cache/&lt;arch&gt;/&lt;pkg's_dex_odex_vdex_art_oat&gt;
            /storage/emulated/&lt;user_id&gt;/Android/obb/&lt;pkg&gt;
            /data/misc/profiles/ref/&lt;pkg&gt;
Cache       /data/user/&lt;user_id&gt;/&lt;pkg&gt;/*cache
            /data/user_de/&lt;user_id&gt;/&lt;pkg&gt;/*cache
            /storage/emulated/&lt;user_id&gt;/Android/data/&lt;pkg&gt;/*cache
User data   /data/user/&lt;user_id&gt;/&lt;pkg&gt;
            /data/user_de/&lt;user_id&gt;/&lt;pkg&gt;
            /storage/emulated/&lt;user_id&gt;/Android/data/&lt;pkg&gt;
            /storage/emulated/&lt;user_id&gt;/Android/media/&lt;pkg&gt;
            /data/misc/profiles/cur/&lt;user_id&gt;/&lt;pkg&gt;



User data size should exclude Cache size.
For user apps compiled binary files are stored in installation directory (/data/app/&lt;pkg&gt;/oat/&lt;arch&gt;) since Lollipop. But for system apps those are saved to /data/dalvik-cache which is counted for apps size. Actual .apk files of system apps are not counted, except if an app is updated. .odex files for Android's framework apps (.apk/.jar) however might be already stored in /system/framework/ having only symlinks in /data/dalvik-cache/. Things have changed with A/B implementation.
For more details see Where Android apps store data?


Taking sum of all these directories:

~# du -sb /data/app /data/misc/profiles/ /data/dalvik-cache/ /storage/emulated/*/Android/ /data/user/*/ /data/user_de/ |  sort -n | awk '{sum += $1} {printf "%-15s%s\n",$1,$2} END {print sum}'
94152          /storage/emulated/11/Android/
611998         /data/misc/profiles/cur/10/
837897         /storage/emulated/10/Android/
1013850        /data/misc/profiles/cur/0/
1109311        /storage/emulated/0/Android/
1602419        /data/misc/profiles/ref/
3294944        /data/user_de/10/
10283019       /data/user/10/
86048161       /data/user_de/0/
252376438      /data/dalvik-cache/
1537995332     /data/app
1817762284     /data/user/0/
3713029805


It's 3.7 GB, leaving only 250 MB behind, some of which is taken by /sdcard of other two user profiles (/data/media/&lt;user_id&gt;). The rest is used by system logs and configuration files, particularly in /data/system* and /data/misc*. This system usage is shown as "System" which excludes shared storage size (5, 6). Some figures differ from Android but after all we know how the space is actually used, and where it's being wasted.



RELATED:


Android's Storage Journey