Search code examples
centosvirtual-machinevirtualbox

VirtualBox machine has free space but I'm getting low disk space errors/messages


Today I upped the storage on my machine, how ever I'm getting some low space disk errors. The command df -h returns the following:

[caramelo@localhost tmp]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  9.8G  9.8G  3.6M 100% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G   18M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  221M  794M  22% /boot
SFolder                  238G  207G   31G  88% /media/sf_SFolder
tmpfs                    380M  4.0K  380M   1% /run/user/42
tmpfs                    380M   48K  379M   1% /run/user/1000
tmpfs                    380M     0  380M   0% /run/user/0

I used Gparted to expand /dev/sda2/ which is not being displayed in the list above and using du -sh /dev/sda2 returns

[caramelo@localhost ~]$ du -sh /dev/sda2
0   /dev/sda2

To give more storage space I cloned my existing .vdi with vboxmanage clonehd “CentOS7.vdi” “CentOS7Clone.vdi” and then vboxmanage modifyhd –resize 20000 “CentOS7Clone.vdi” and finnaly on VirtualBox Settings I added the cloned .vdi and deattached the original .vdi

Back on CentOS I used the Gparted to expand /dev/sda2 with the unallocated space I added with the vboxmanage modifyhd command.


Solution

  • After I allocated all the free space to sda2 partition, confirmed the changes and reboot the OS I solved the problem using the commands lvextend -l +100%FREE /dev/mapper/centos-root and xfs_growfs /dev/mapper/centos-root