Understanding VDI disk usage

Discussions about using Linux guests in VirtualBox.
Post Reply
Blackbird
Posts: 4
Joined: 17. Jul 2010, 21:41
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: CentOS 5.5

Understanding VDI disk usage

Post 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)?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Understanding VDI disk usage

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Blackbird
Posts: 4
Joined: 17. Jul 2010, 21:41
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: CentOS 5.5

Re: Understanding VDI disk usage

Post 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...
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Understanding VDI disk usage

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply