How To Increase VirtualBox Virtual Machine Disk Size

When you use VirtualBox to manage virtual machine, you may encounter virtual disk space not enough issue, so you have to create a new virtual machine with a bigger virtual disk or you can increase current virtual machine disk space size to make more disk space to use. This article will tell you how to increase the virtual machine disk size in VirtualBox. This example will use VirtualBox MacOS version and the virtual machine is ubuntu Linux.

1. Increase Virtual Machine Disk Virtual Size.

  1. Open VirtualBox and click Global Tools —> Virtual Media Manager menu item. Then you can select the virtual disk file(Ubuntu.vdi) and change the file size use the bottom slider bar. You can only increase the disk file size, can not decrease the file size. Do not forget click Apply button.
    open virtual media manager to change virtual machine disk file size
  2. You can also run VBoxManage command in terminal to resize the virtual disk file size as below.
    192:Ubuntu$ VBoxManage modifymedium "/Users/jerry/VirtualBox VMs/Ubuntu/Ubuntu.vdi" --resize 30000
    0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
  3. Now right click the ubuntu virtual machine in VirtualBox, click Settings menu item, then click Storage and select the virtual disk file ( Ubuntu.vdi ) in left, you can see it’s detail information in right panel. From below picture, we can see that the new Virtual Size is 30 GB, but the Actual Size is 5.71 GB. Now the virtual disk file virtual size has been increased, we need to allocate the newly added space in the virtual machine os.
    virtualbox virtual machine ubuntu disk file status

2. Convert Virtual Machine Disk File Storage Allocation Mode From Dynamic To Fixed.

Before you can allocate additional space size in virtual machine os, you should make sure that your virtual machine storage allocation mode is Fixed size storage. If the storage allocation mode is Dynamic, you should first convert the dynamic mode to fixed size storage mode. Otherwise you can not find the place to allocate newly added disk space in virtual machine os.

READ :   How To Install ShadowSocks On Google Cloud Linux

From above picture, we can find our virtual disk file storage allocation mode is Dynamically allocated storage in right panel Details line. So we need first to clone the virtual disk to another one and then set the storage allocate mode to Fixed size.

  1. Clone virtual disk file to convert storage allocation mode from Standard( dynamic) to Fixed size. Open a terminal and run below command.
    $ VBoxManage clonemedium disk "/Users/jerry/VirtualBox VMs/Ubuntu/Ubuntu.vdi" 
    "/Users/jerry/VirtualBox VMs/Ubuntu/Ubuntu-clone.vdi" -variant Fixed
  2. In above command line we use VBoxManage command to clone the Ubuntu.vdi to Ubuntu-clone.vdi, and pass -variant Fixed argument to make the new virtual machine disk file Fixed storage allocation mode.
  3. Open virtual machine Settings window, click Storage tab at top then click the Adds hard disk icon(the last icon in Controller: SATA item), and choose the newly cloned virtual machine disk file ( Ubuntu-clone.vdi ). Click the vdi file, you can find the Virtual Size and Actual Size is same 30.00 GB. Right click the old Ubuntu.vdi file, click Remove Attachment menu item to remove the old virtual machine disk file.
    add hard disk files in virtualbox virtual machine

3. Allocate Additional Space Size In Virtual Machine OS.

3.1 Use Ubuntu Disks Utility Tool.

  1. Start and login ubuntu os.
  2. Then search keyword disk in Show Applications area ( Click the bottom left icon in ubuntu desktop to show applications).
    search disks utility in ubuntu os
  3. Click the Disks utility tool to open it. Click the VBOX hard disk in left, then you can find the unallocated disk space ( Free Space ) in right.
    ubuntu disks utility tool to allocate additional disk space
  4. Click the Additional partition options icon ( the third icon ) at Volumes bottom. Then click Resize… menu item to open the Resize Volume popup dialog. You can change the disk volume space size in it.
    additional partition options resize menu item
READ :   Linux User Group And File Permission Introduction

3.2 Use Third Party Tool Gparted.

  1. Gparted is an open source free disk volume management tool. You can download the gparted iso file from it’s official website.
  2. Then install the iso file in the VirtualBox virtual machine Settings —>Storage —> Controller: IDE as the dvd disk.virtualbox choose gparted iso file
  3. Open virtual machine Settings dialog, click System icon, then move the Optical device to the first order in the Boot Order to load the os from the gparted iso.
    move optical device to the first boot position
  4. Now restart the ubuntu virtual machine, it will load the gparted iso file, follow the steps in the prompt dialog, click enter key for three times, then you can see below gparted GUI.
    gparted gui to allocate additional disk space
  5. Select the /dev/sda1 partition, then click Resize/Move menu icon at top menu, then you can assign additional disk space to /dev/sda1 partition.

3.3 Install Gparted Tool After Start Ubuntu.

Besides load the gparted at ubuntu start time, you can also install gparted after ubuntu os start.

  1. Login ubuntu os.
  2. Open a terminal and run below command to install gparted in ubuntu.
    $ sudo apt-get install gparted
  3. After install gparted successfully, run gparted command in terminal to open the GUI dialog to increase the partition size.
    $ gparte

Reference

  1. How To Install Ubuntu On Virtualbox MacOS Version
(Visited 39 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.