Skip to main content

free

Function free 

Source
pub fn free(path: &Path) -> Result<(f64, u64)>
Expand description

How much of the filesystem holding path is still free: the fraction of its total size, and the same quantity in bytes.

Both come off one statfs because neither answers the question alone. A fraction calls 45 GiB free on a 1 TB volume “5% free, nearly full” when that is more room than most deployments ever use; a byte count cannot tell a comfortable 64 GB SSD from one about to wedge. Whoever is deciding to delete data wants both, and wants them from the same instant.

f_bavail, not f_bfree: the difference is the root reserve (5% on a default ext4), which is space the process cannot write into and therefore not space Mira has. Both terms of the ratio are in blocks of f_bsize, so the block size cancels out of the fraction — it only appears in the bytes.