-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong allocated file size (invalid blocks*blocksize calculation) #830
Comments
Can you show me some samples? SD Maid uses the size on disk value and formats it via Androids shorthand file size format method. |
Is this on SD Maid v4.6.5? What sizes does SD Maids explorer show? |
Just checked. No update available after 4.6.4. |
v4.6.5 is beta atm, but it doesn't matter in this case. The first size is allocated size in the filesystem (size on storage) (e.g. how many blocks). The second size is the file size as reported by the file itself. They usually differ when a file is a sparse file: (I need to explain this in the wiki, thx for reminding me) I think there is an issue with determining the size on disk. I checked the code and SD Maid assumes a blocksize of 512 for the blockcount value we get from Seeing as the factor really is roughly 8, it's likely giving the blockcount for a blocksize of 4096Byte instead of 512Byte. Why though... What binary is SD Maid using? Check in SD Maids overview. |
Hm using SD Maids own toybox should be ok... Did you make any fancy file system changes on your device? Btw updated the wiki: https://github.com/d4rken/sdmaid-public/wiki/Explorer#file-size Can you run these command from a shell, file doesn't really matter, just something on your internal sdcard.
The first one uses SD Maids |
Not sure. From your screenshot we can see that:
So 13563 * 4096 Byte = 55554048 Byte is a lot closer the the actual file size, than 13563 * 512 Byte = 6944256 Byte. But the last time this came up (calculating allocated size), see here, it turned out that the blockcount from When you browse with SD Maids exploret to |
Can you install a busybox of your choice and run the |
Currently running out of ideas. It all looks OK, except for the too small allocated size. |
Yeah, me as well. |
So far it seems F2FS related, but I'm out of my depth here. I've posted to the toybox mailing list, asking for help. http://lists.landley.net/pipermail/toybox-landley.net/2017-April/008919.html |
How can it be F2FS related? The data partition showed the correct sizes in explorer. The last screenshot in my post with the partitions. |
Right, good point. I've been staring at the screen for too long.
What sizes do you see when you browse the folder directly (not through FUSE), i.e |
I always thought that the media partition was simply symlinked for legacy purposes. SD Maid reads the proper sizes through /data/media/0. |
AFAIK
Possibly, at least there are options like this that point to the possibility.
Looking deeper, it seems that the problematic blockcount value comes directly from the system see Seeing as the "wrong" value comes directly from the system call, I'd say this is neither a bug in SD Maid nor in toybox, but rather a system bug or config issue. Would you agree? That would leave the question whether SD Maid can reasonably do something about this. |
It would seem so. I will try an AOSP/LOS based ROM tomorrow or day after to see if it makes a difference. Will report back if it is successful. As far as what SD Maid can do, I haven't read enough about storage to know if it is possible, but how feasible would it be to read the file size directly from the file? |
We already know the file size, see the other value displayed by the explorer. With stuff like comparing sizes, deleting, apps sizes, we want to know how much space is occupied on storage, i.e. the allocated size or occupied size (terminology is confusing). We could delete a 10GB file and only free 1MB (e.g. sparse file), if we then use and display 10GB, that would be pretty missleading, which is why SD Maid prefers allocated size over file size in most tools. |
Got a response on the mailing list. We were on the right track. The stat call returns the wrong value. http://lists.landley.net/pipermail/toybox-landley.net/2017-April/008925.html This was only fixed quite recently, see: I can't really do much from my end, but I could provide an option to change the storage analyzers sort mode from using "allocated size" to "file size"? Would that be worth it though? Is this a useful option? Seems after all this would just be a semi workaround for this bug here. For further discussion of that: #831 |
I updated the kernel. To one that specifically mentioned having merged the sdcardfs fixes. But the file size was still wrong. I think it could be because toybox still has that hard coded 512. Could it? I guess an option to choose the sorting mode would be good enough as a fix. It is not too critical of a bug anyway. |
Hm not sure why this isn't fixed in the newer kernel, a bit out of my depth... maybe you could ask the kernel maintainer?
No, a hardcoded 512 is ok, because the linux kernel docs specifically states that the blockcount value is always in units of 512. |
Fixed the reported file sizes by disabling sdcardfs in build.prop. |
I guess that works too as solution 😁 Still curious why this isn't fixed by using the latest kernel, maybe there are ROM changes required too. |
I talked to the kernel dev. |
Final update. |
Awesome :) |
The same problem also appears on my mobile phone. |
My phone is Honor 6X. The ROM is EMUI 5.0.1 based on Android 7.0. |
The Storage Analyzer reports the file size as about 1/8th (bit-byte conversion issue?) the actual size.
I couldn't find it having been reported before.
Is this limited to me? I can provide screenshots, if required.
The text was updated successfully, but these errors were encountered: