I'm using php to try and work out the total, available & used space on a disk.
This is the code I'm running :
$total = (disk_total_space("/")/1024);
$available = (disk_free_space("/")/1024);
$used = ($total - $available);
echo "$total\n\n";
echo "$available\n\n";
echo "$used\n\n";
and the output returned :
305594616
293030828
12563788
A df of the same partition returns the same values of the Total and Available, but used is different.
df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 305594616 11632392 293030828 4% /
Why does php show 12563788
and df show 11632392
?
Is there anyway to get accurate values ?
Thanks