How To Increase Virtualbox Disk Size For Fixed Size Disk

In this tutorial, I’m going to show you how to increase Virtualbox disk size for fixed size disks. I assume that your host OS is Linux. If you want to know how to increase the size of a fixed size disk, then read the previous article.

Find Out If Your Virtual Disk is Fixed Size

Open you virtual machine settings and click Storage on the left pane. Select your virtual disk under Storage Tree. You can see the information about your virtual disk on the right. You can see that my virtual disk is fixed size.

Find Out If Your Virtual Disk is Fixed Size

Backup Your Virtual Hard Disk

Before we increase the size of our virtual hard disk, it’s always a good idea to make a backup of it in case something go wrong.

First, right click on the location line and copy the location of your virtual hard disk.

Backup Your Virtual Hard Disk

Next open up a terminal on your host OS and run the following command to backup the virtual hard disk.

cp /location-of-virtual-disk /location-of-backup-of-virtual-disk

Repalce the location with the real location of your virtual disk. For example, I executed this command:

cp /media/matrix/sdb9/VMs/openSUSE.vdi /media/matrix/sdb9/VMs/openSUSE-bakcup.vdi

Make sure your backup disk name is different from the origial disk name.

Increase Virtualbox Disk Size For Fixed Size Disks

First we add a new virtual disk that is larger than the original virtual disk, then we will use the dd utility to copy the OS on the original virtual disk to the new virtual disk. Next, we will make the OS to use all disk space of the new virtual disk. Finally We can delete the original virtual disk from virtual machine.

Add a New Virtual Disk

Open virtual machine settings and click Storage on the left pane. Under Storage Tree, click Contorller: SATA, then click the plus icon at the bottom to add a new hard disk.

Add a New Virtual Disk

Select Create new disk on the next window.

Create new disk

You can choose whatever file type you like. I choose VDI for this tutorial.

hard drive file type

In the next screen, I choose my hard disk to be dynamically allocated because it takes less time to create. You can choose fixed size if you like.

dynamically allocated

Give your new disk a name and select a size for it. Click create.

create new disk

Now a new disk is created and is attached to your virtual machine.

2 virtual disk

Use dd to Copy Guest OS to the New Disk

In order to use dd to copy guest OS to the new disk, we need to boot virtual machine from a Linux Live image.

Click on Controller: IDE, then click on the optical disk icon to select a Linux live image from your computer.

choose a live image

After you save your settings, start the virtual machine. Once you are in a Linux Live OS, open up a terminal, run the following command to copy /dev/sda to /dev/sdb.

sudo dd if=/dev/sda of=/dev/sdb

Your old disk is /dev/sda and your new disk is /dev/sdb. If you are not sure, open Gparted in the Linux Live OS to know which is which.

The copy process can take quite a while. Once it’s done, open Gparted in Linux Live OS. Select your new disk, you can see that your guest OS has been copied to the new disk and there are some unallocated disk space because the old disk is smaller than the new disk.

gparted

Now you can resize your root file system to use the unallocated space. Once it’s done, shut down your virtual machine and open the settings window, remove your old disk and the live iso image from virtual machine.

remove attachment

Save your settings and start virtual machine again. You can use the following command to check the size of your new disk in the guest OS.

sudo fdisk -l
Rate this tutorial
[Total: 14 Average: 4.8]

8 Responses to “How To Increase Virtualbox Disk Size For Fixed Size Disk

  • This doesn’t work for Fedora, FYI

  • Hi, I did the above steps and after converting even though gParted (in VM) shows the space, its showing encrypted and the OS does not think it has that much space

  • It worked. My host OS is Windows 7 and the guest Ubuntu 12.04.

  • Or you could create openSUSE2.vdi and then use VBoxManage clonemedium openSUSE.vdi openSUSE2.vdi –existing

  • nice! it works! thanks! i use windows 10 and Ubuntu 18.04

  • Linux for Work
    4 years ago

    Wonderful, it worked perfectly also with Win 10 and Ubuntu 18.04, thanks !

  • Worked the exactly as described. I used a Ubuntu 20.04 live iso instead of openSUSE but worked just the same. Thanks again!

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here