I would like to know exactly what du
and df
mean.
The following is an example of the output of the df
command.
Filesystem Size Used Avail Use% Mounted on
ubi0:rootfs 435M 424M 12M 98% /
devtmpfs 88M 4.0K 88M 1% /dev
tmpfs 248M 0 248M 0% /dev/shm
tmpfs 248M 8.4M 240M 4% /run
tmpfs 248M 0 248M 0% /sys/fs/cgroup
tmpfs 248M 0 248M 0% /tmp
tmpfs 248M 72K 248M 1% /var/volatile
And here's the output of du
(run in the /
directory)
$ du -sh home
255M home
$ du -sh usr
264M usr
I thought that ubi0:rootfs
included /home
and /usr
, but the sum of them, 519M, is larger than the ubi0:rootfs
size, 435M.
The result of the free
command is as follows.
total used free shared buff/cache available
Mem: 495M 55M 50M 8.4M 389M 420M
Swap: 0B 0B 0B
At first I thought the difference is due to ramdisk, but the free
command shows RAM is not used so much.
What is the exact difference between du
and df
(or is the /usr
dir special)?
df
anddu
can even produce meaningful values for it. This is not the case for some modern filesystems, like btrfs, for example. Otherwise you'd be trying to make sense out of garbage output.du -shc home usr
(that is one du invocation for both)? Whatdu
implementation is it?