linux, ubuntu

Howto – Increase disk space on a VirtualBox vmdk disk

This post is a continuation of the Howto create VirtualBox Vagrant Development Linux with Ubuntu 14.04 .
I’ve created this post in order to have documented the steps I did to increase the disk space of the VirtualBox image.

Steps to solve the error: “no space left on device error”:

Change directory to your local VirtualBox instalation, and check that it contains the executable VBoxManage. We will need it in order to clone the HD and then resize it with gparted.

Example for Windows:
cd "c:\Program Files\Oracle\VirtualBox"
c:\Program Files\Oracle\VirtualBox>dir
Volume in drive C is OS
Volume Serial Number is

Directory of c:\Program Files\Oracle\VirtualBox

24/07/2015 09:57 .
24/07/2015 09:57 ..
(…)
09/07/2015 11:09 251,656 VBoxBalloonCtrl.exe
09/07/2015 11:09 4,026,088 VBoxC.dll
09/07/2015 11:09 45,144 VBoxCAPI.dll
09/07/2015 11:09 157,408 VBoxDbg.dll
09/07/2015 11:09 2,570,216 VBoxDD.dll
09/07/2015 11:09 204,312 VBoxDD2.dll
09/07/2015 11:09 25,080 VBoxDD2R0.r0
09/07/2015 11:09 22,704 VBoxDD2RC.rc
09/07/2015 11:09 155,360 VBoxDDR0.r0
09/07/2015 11:09 124,888 VBoxDDRC.rc
09/07/2015 11:09 390,712 VBoxDDU.dll
09/07/2015 11:09 44,120 VBoxDragAndDropSvc.dll
09/07/2015 11:09 18,368 VBoxDTrace.exe
09/07/2015 10:41 1,048,576 VBoxEFI32.fd
09/07/2015 10:41 1,048,576 VBoxEFI64.fd
09/07/2015 11:09 60,600 VBoxExtPackHelperApp.exe
09/07/2015 10:59 58,601,472 VBoxGuestAdditions.iso
09/07/2015 11:09 46,704 VBoxGuestControlSvc.dll
09/07/2015 11:09 49,288 VBoxGuestPropSvc.dll
09/07/2015 11:09 411,800 VBoxHeadless.dll
09/07/2015 11:09 1,163,712 VBoxHeadless.exe
09/07/2015 11:09 26,104 VBoxHostChannel.dll
09/07/2015 11:09 1,290,920 VBoxManage.exe
09/07/2015 11:09 460,216 VBoxNetDHCP.dll
09/07/2015 11:09 1,163,712 VBoxNetDHCP.exe
09/07/2015 11:09 569,944 VBoxNetNAT.dll
09/07/2015 11:09 1,163,712 VBoxNetNAT.exe
09/07/2015 11:09 200,680 VBoxOGLhostcrutil.dll
09/07/2015 11:09 99,216 VBoxOGLhosterrorspu.dll
09/07/2015 11:09 124,960 VBoxOGLrenderspu.dll
09/07/2015 11:09 676,552 VBoxREM.dll
09/07/2015 11:08 947,912 VBoxRes.dll
09/07/2015 11:09 5,492,296 VBoxRT.dll
09/07/2015 11:09 480,304 VBoxSDL.dll
09/07/2015 11:09 1,164,224 VBoxSDL.exe
09/07/2015 11:09 30,736 VBoxSharedClipboard.dll
09/07/2015 11:09 1,140,016 VBoxSharedCrOpenGL.dll
09/07/2015 11:09 41,560 VBoxSharedFolders.dll
09/07/2015 11:08 12,176 VBoxSupLib.dll
09/07/2015 11:09 5,737,936 VBoxSVC.exe
09/07/2015 11:09 157,944 VBoxTestOGL.exe
09/07/2015 11:09 2,693,792 VBoxVMM.dll
09/07/2015 11:11 17,172,512 VBoxWebSrv.exe
09/07/2015 10:52 2,355,485 VirtualBox.chm
09/07/2015 11:09 11,252,072 VirtualBox.dll
09/07/2015 11:09 1,164,224 VirtualBox.exe
09/07/2015 11:09 1,172,536 VMMR0.r0
09/07/2015 11:09 841,448 VMMRC.rc
24/07/2015 09:57 x86
60 File(s) 148,113,539 bytes
8 Dir(s) 102,299,119,616 bytes free

Ok, so now that you are in the right directory, execute the following command:
VBoxManage clonehd “box-disk1.vmdk” “cloned.vdi” –format vdi

Have in mind that you should use absolute paths in order to properly locate the folders, as the example:
c:\Program Files\Oracle\VirtualBox>VBoxManage clonehd "C:\Users\tmodeneis\VirtualBox VMs\ubuntudesktop_default_1444393401994_92719\box-disk1.vmdk" "C:\VirtualBox VMs\cloned.vdi" --format vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'vdi'. UUID: 63ab6f6f-5776-4351-9d28-565bac925f03

c:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd “C:\VirtualBox VMs\cloned
.vdi” –resize 30720
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%

Ok now we have cloned our old vmdk to vdi, the next step is to resize the partition with gparted.

1) First thing to do is replace in the virtualbox the old .vmdk to start using the just cloned new .vdi
Once this is done, Download the Live CD iso of gparted and boot the virtual box server from it.

1

2) Select the default option and complete the startup.

2

3

4

3) GParted shows the size of current partitions (15.9 GB) and the unallocated space (20 GB).
5

4) Right click on the partition to resize and select resize/move item from the popup menu.
6

5) Resize the partition by either dragging the highlighted box or adjusting the numerical spinners.
7

8

9

6) Click apply to complete the resizing.
10

11

12

7) Restart the virtual server and see the size of linux partition changed 🙂

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 35G 13G 21G 39% /
/dev/sda1 99M 12M 83M 13% /boot
tmpfs 1006M 0 1006M 0% /dev/shm

Thomas.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s