Df command on Centos/VirtualBox

centosdisk-usagestoragevirtualbox

I'm studing the use of df, when i tried it on centos 7 on my virtualBox, i got this :

df -h 
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  9.6M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root  8.0G  5.3G  2.8G  66% /
/dev/sda1               1014M  239M  776M  24% /boot
tmpfs                    379M   24K  379M   1% /run/user/1000

i don't understand from where all this space came from, because i have only 10G when i first created this VM, and 4G for the RAM, and in the configuration of the VM i get this :

enter image description here

Information when i click in storage  : 
type : Normal (VDI)
virtual size : 10G
reel size : 4.86
details : storage of differentiation
Emplacement : ...
attached to : centos (install snapshot)

Best Answer

df shows all mounted filesystems, which include tmpfs virtual filesystems that reside in memory.

From your df output you have just two filesystems saved on disk:

  • 1 GB /boot on sda1 partition
  • 8 GB / on centos-root logical volume

The remaining 1 GB from your disk is most likely used for swap which is not shown in df output (you can use lsblk to list block devices on your system, it will show swap too).

The content of remaining mountpoints you see (/dev, /run...) is stored in memory. These are special folders created dynamically by the OS (for example /dev contains special files that represent block and character devices in your system). RAM for these is allocated dynamically when needed, these don't actually take 2 GB of RAM each, the size is just an upper limit.

Related Question