I'm using VirtualBox 6 on Ubuntu 18.04.3 LTS. I need to add more storage space to the guest OS.
I already ran VBoxManage modifyhd box-disk002.vdi --resize 46080
but the old value remains.
Below is a screenshot of the settings. I tried to use the slider to increase the disk size but that didn't work either.
How to add more storage space?
Guest OS: Linux Ubuntu 20.04
I am more comfortable adding a new .vdi disk image using the virtual box and then mount that to the existing Linux guest OS. I read somewhere on a Linux/VM forum that changing the storage size of the current disk where you have data available can cause issues. I increased my disk space by adding a new vdi disk.
Here is the article I followed. It is very easy to follow.
https://www.zachpfeffer.com/single-post/add-a-disk-to-an-ubuntu-virtualbox-vm
In my case I didn't install
gksu
. Instead, I usedsudo
in place ofgksudo
. In the article, author is using vmkd as hard disk file type. I used vdi as hard disk file type. Apart from that, all steps are sameBrief outline of the steps:
Create a disk file
Partition in Ubuntu
In Ubuntu, open a terminal and identify the disk from the output of
You will see a disk that matches the size of the one you created. For example it may be
/dev/sdc
Install gparted (run
sudo apt install gparted) and run
sudo gparted`Click the device (
/dev/sda
) in the top corner and switch to the disk you identified (for example/dev/sdc
Click Device and then Create Partition Table
Leave as msdos and click Apply
Click the create new partition icon (top left)
Leave everything as is and click Add
Click the green check mark to apply all operations
Click Apply in the popup and Close* when successfully completed
Mounting the disk
Create a mount point (
hdd2
is just an example name - change if you prefer something else)Add a line to
/etc/fstab
to mount the new partition on bootAdd this line
Save, exit and restart the VM.
Hope it helps. :)
I'll recommend to run this command again
and then resize file-system by booting VM from some LiveCD with
gparted
.References:
https://www.virtualbox.org/manual/UserManual.html#vboxmanage-modifyvdi