How sizes are measured
- An attachment’s size comes from the
filesizevalues WordPress records in attachment metadata (WordPress 6.0 and later), falling back to the file on disk. Variants sharing one file are counted once, and the pre-scaling original WordPress keeps for large uploads (original_image) counts as a variant. - Directory sizes are apparent sizes in bytes (
du -b, or the PHP file sizes), so they agree with attachment sizes. A host’s quota usually counts disk blocks and reads a little higher. - On multisite the main site’s uploads directory also holds every other site’s under
sites/, so the main site’s figure has that subtracted. - Uploads on disk includes files that are not in the media library, so it can be well above the media library figure. A big gap is worth an install scan of uploads.
The shell driver
When shell_exec is enabled and du is on the path, directories are measured with GNU du and large files found with find. Each command is fixed in the code; its only variable part is a path that has been resolved with realpath(), confirmed to be inside the WordPress install and passed through escapeshellarg(). Commands run under timeout when it exists, and a missing final total marks the result incomplete. The network features that use it are limited to super admins. When the shell is unavailable, or lh_disk_usage_use_shell returns false, a PHP walk does the same job within the time budget and reports anything it could not finish as incomplete. Plugin Check reports shell_exec; that is expected.
Moving from Media Library File Size
LH Disk Usage measures everything itself and does not read Media Library File Size’s data. That plugin stores SS88MLFS and SS88MLFSV post meta and its uninstall routine only removes them from one site, so on multisite use the leftovers action on the network screen once it has been removed.