Page 1 of 1

Understanding VDI disk usage

Posted: 18. Jul 2010, 19:21
by Blackbird
Hello,

I'm writing this post because I'm facing a "disk full" error due to only 626 small megabytes remaining on my Linux guest "/" partition.

This is the status of 10GB expanding VDI used by the guest system (NewHardDisk2.vdi - with 2 snapshots):
Image
The "actual size" of those files corresponds to what Windows Explorer says.

And that is the result of the disk usage while executing the "df -h" command in the guest system:

Code: Select all

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      5.8G  4.9G  626M  89% /
/dev/sda1              99M   19M   75M  21% /boot
tmpfs                1006M     0 1006M   0% /dev/shm
/dev/hdc               32M   32M     0 100% /media/VBOXADDITIONS_3.2.6_63112

I don't see any connection:
- I should have a lot more than 626MB of free space
- How can the total used hard-disk space given by "df" be bigger than the actual size of the VDI (3.7GB)?
- How can the total hard-disk space (free+used) given by "df" be different than the virtual size (10GB)?

Re: Understanding VDI disk usage

Posted: 18. Jul 2010, 20:18
by Sasquatch
The use of the 'df' command is not accurate to measure your disk space for a whole hard drive. It does show you the usage on the partitions where you can write, but it does NOT show the swap partition and it's use. As I see it here, you have a hard drive of 10 GB, split up in these parts, given from your 'df -h' output:
- 5,8 GB root partition
- 0.1 GB boot partition
- 4,1 GB swap partition

Why the 4,1 GB swap? That's simple math: 10 GB - (5,8 + 0.1) = 4.1 GB. If you want to see how the partitions are divided, you should've used 'fdisk -l' as root.

Why the hard drive use from df is more than 3,7? You forgot to add the 4 GB of your snapshot. When you create a snapshot, all changed and added data is not stored in the main VDI, but in the snapshot file instead.

Re: Understanding VDI disk usage

Posted: 18. Jul 2010, 23:07
by Blackbird
Hi Sasquatch, and thank you for your answer.

This is the result of "fdisk -l":

Code: Select all

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1305    10377990   8e  Linux LVM
Listed as 10GB indeed :)

I don't see any swap partition though...

Re: Understanding VDI disk usage

Posted: 18. Jul 2010, 23:14
by Sasquatch
The swap is on the LVM volume. Either way, you need to learn more about how Linux works, including it's storage systems like LVM. Questions like this should be asked on a specialized Linux forum, like your distro's.