2

Need help figuring out why Ubuntu is mis-reporting disk capacity on a VM. Just installed Ubuntu 12.04 Server LTS 64 bit on a Virtualbox (version 4.2.10) virtual machine. I also installed the Ubuntu desktop on this server.

I created the virtual disk (VDI option) as 8GB with the Dynamically allocated option. Virtualbox currently reports the actual size at 1.7GB

Virtualbox

The Ubuntu Disk Usage Analyzer shows the drive has a total capacity of 4.2GB which makes no sense.

Disk Usage Analyzer

I pulled this info from the command line and it doesn't match the GUI report. It adds up to just under 8GB which is right. I'm unclear about why "udev" and "tmpfs" both are allocated at 2GB since this a new install.

Command line

I installed GParted and it shows the extended partition correctly to be be 7.6GB.

GParted

So why is the Gui misreporting drive capacity and how do I fix this? I can't install anything else because I'm getting warnings in the desktop about there only being 25MB of space left. I already ran 'sudo apt-get clean' and it did nothing. I also tried resizing the VDI disk itself from the my hosts command line but an error:

c:\VBoxManage modifyhd ozzman2.vdi --resize 20000
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!
2
  • Run a lvs on the command line. You may need to resize the logical volume to use all the available space.
    – Steve-o
    Apr 10, 2013 at 19:12
  • I got this from lvs: root ubuntu1 -wi-ao 3.73g swap_1 ubuntu1 -wi-ao 4.00g. What is swap_1 and why is it taking up that much space? Apr 10, 2013 at 20:03

2 Answers 2

3

You have 4GB space used as virtual memory aka swap.

You will probably want to assign more disk for storage. There are a couple of choices but the simplest and most expedient is usually to recreate the installation with a larger size. Alternatives include:

  1. Resize the disk within VirtualBox, extend the physical extent, then the logical extend, then the ext4 file system afterwards.
  2. Add a new disk to the virtual host and add that to LVM as a new physical volume and extend the root logical volume to use that space, subsequently extend the ext4 file system to use the new space.
  3. Add a new disk and mount somewhere new e.g. /opt and use that as desired.

Random article on Google that may assist:

http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms

1
  • #1 pretty much covered it, but @mdpc also helped with his comments too. took me a while to google all this stuff and figure out how to do this via the command line. not fun or easy for beginner. Apr 11, 2013 at 0:08
2

Of course, the 1.7 GBytes is the actual size on the underlying physical disk that is allocated.

The virtual host assumes that the full amount is present, but the underlying Hypervisor will create the necessary storage as needed. If you are wondering where your disk allocation has gone, I'd use fdisk and check the size of each partition.

In the case of LVM, it may be that some of the physical volume although allocated is not in a Logical volume yet. Look at vgdisplay -v /dev/ubuntu1. You'll probably see some unallocated Extents that could be allocated to the root logical volume or to another LV altogether. (ubuntu1 seems to be the volume group name, and in your display root is the logical volume residing within that volume group).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .