Disclaimer: I just did these steps once after 2 hours of research on a VirtualBox Version 6.0.10 r132072 (Qt5.6.2) installed on Windows 10 and it worked. Make sure you know what you are doing.
Let's assume these:
- Your VM VirtualBox installation folder is:
C:\Program Files\Oracle\VirtualBox - Your VM files are in
D:\VM\ubuntu\18.04\. fixed-18.04.vdiis a 40GB fixed size storage that we want to resize.
Steps:
- Shutdown your Ubuntu VM.
- Backup your current
*.vdifile somewhere safe. - Open
Oracle VM VirtualBox Manager. - Go to
File -> Virtual Media Manager. - Select the Hard Disk you want to resize and release it.
- Now open
Startof Windows 10 and typecmd. It's full name is Command Prompt. Right click on it and run it as administrator. - Run
cd C:\Program Files\Oracle\VirtualBoxto change directory. - Run
.\VBoxManage.exe clonehd "D:\VM\18.04\fixed-18.04.vdi" "D:\VM\18.04\dynamic-18.04.vdi". This command clones your.vdifile and makes it a dynamically allocated storage. This might take a while. - Run
.\VBoxManage.exe modifyhd "D:\VM\18.04\dynamic-18.04.vdi" --resize 65536to have a 64GB drive. It'll be fast. - Open
Oracle VM VirtualBox Manager. - Go to
File -> Virtual Media Manager. - Add the
dynamic-18.04.vdifile. - Close
Virtual Media Manager. - Right click on your VM (Ubuntu) and go to
Settings. - Select
Storagetab. - Select
Controller: SATA. - Select
Add a Hard Disk. - Select
Choose existing Disk. - Select
dynamic-18.04.vdi. - Start your VM.
- Open terminal.
- Run
sudo apt install gparted - Run
gparted. It'll ask your password. Answer it correctly. - Resize your partition. Make sure to Apply it.
- Be happy.