0

I am new to Linux, and VirtualBox. I am running Ubuntu 16.04 using Virtualbox on Windows 10 host. Initially I had setup the virtual machine to use 8 GB, Dynamically Extendable drive (VHD).

I am looking to extend the size of this virtual hard drive now.

Here is what I have done so far (based on the information available on various posts)

  1. Ran VBoxManage command
  2. Changed Storage settings on VirtualBox
  3. Started Ubuntu
  4. Opened GParted
  5. The option to resize/move the partition is enabled, but on the next window, I am unable to increase the size (it does not allow). Please see images below. Greatly appreciate if anyone can help!!!

Gparted view:

GParted view

Gparted Resize views:

Gparted Resize views

1

A dynamically expanding virtual hard disk is one in which the size of the .vhd file grows as data is written to the virtual hard disk. They generally start out quite small and grow to the maximum size you set. The reason you can't resize it with gparted is it's dynamic and only grows when data is added to it and that size is curtailed by the maximum that you set. Since your image shows the lvm flag on your volume, I'm assuming you are using the Logical Volume Manager.

Create a new partition in the unallocated space you show in your image.

Then reboot your VM or issue the command echo 1 > /sys/class/block/sda/device/rescan to tell the kernel to rescan the drive.

Determine the device name of your new partition. I will use the example of /dev/sda6. (change this to match your situation)

To add this to our LVM configuration first we create a physical volume using the device name we determined previously.

pvcreate /dev/sda6

Next determine the name of your volume group by issuing the command pvdisplay look for a line that looks something like this:

VG Name ubuntu-1604

I will use ubuntu-1604 in this example as the volume group name. Modify as necessary to match your conditions

Using this info obtained in the above process we will extend our volume group with the command vgextend VG name device name for example:

vgextend ubuntu1604 /dev/sda6

Find the logical volume name with the command lvdisplay

It might be:

LV Name /dev/ubuntu-1604/root

Now, let's extend the logical volume to all free space available: lvextend -l+100%FREE /dev/ubuntu-1604/root

Finally lets look to see how we did with df -h

Sources:

LVM HOWTO

expand hard disk LVM

  • Thanks a lot for the help 'Elder Geek'! geoffstratton.com/expand-hard-disk-ubuntu-lvm helped a lot... – Ravi Kiran Nov 4 '16 at 2:00
  • @RaviKiran I'm glad it helped! Please make a habit of upvoting/accepting answers that work for you so that others with the same problem can find answers that work. – Elder Geek Nov 4 '16 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.