0

When I perform this df mnt/sdcard/ on my Xperia Z1 Compact, I get:

Filesystem               Size     Used     Free   Blksize
mnt/sdcard/             11.8G     7.9G     3.9G   4096

But when I do for el in $(ls -a mnt/sdcard/); do du -sh "mnt/sdcard/${el}"; done I get that.

So, the sum is much less than 7.9G. Where has the remaining space gone?

0
2

Android's internal storage is made up of many symbolic links. They point towards different locations of your phone's storage.

/mnt/sdcard internally links to /data/media. This directory just contains your user data but no applications or application data.
/data/ contains multiple directories containing the apps (/data/app) or the app data (/data/data) that all contribute to the used storage.

What you see using df is the total storage statistics of the whole partition, even though you run it on /mnt/sdcard. Citing the Linux manual: df - report file system disk space usage.
This means it takes into account all files and folders on that partition even though you are using a directory of the partition as the parameter.

Conclusion: df returns the statistics for the complete partition, but you are just looking at one directory inside of it.

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.