Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MHM5000/e88aeafbe0643d61725e6e6527d2ec27 to your computer and use it in GitHub Desktop.
Save MHM5000/e88aeafbe0643d61725e6e6527d2ec27 to your computer and use it in GitHub Desktop.
Increase an Ubuntu/Linux virtualbox fixed size viratual disk image (guest) on a Windows 10 (host)

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.vdi is a 40GB fixed size storage that we want to resize.

Steps:

  1. Shutdown your Ubuntu VM.
  2. Backup your current *.vdi file somewhere safe.
  3. Open Oracle VM VirtualBox Manager.
  4. Go to File -> Virtual Media Manager.
  5. Select the Hard Disk you want to resize and release it.
  6. Now open Start of Windows 10 and type cmd. It's full name is Command Prompt. Right click on it and run it as administrator.
  7. Run cd C:\Program Files\Oracle\VirtualBox to change directory.
  8. Run .\VBoxManage.exe clonehd "D:\VM\18.04\fixed-18.04.vdi" "D:\VM\18.04\dynamic-18.04.vdi". This command clones your .vdi file and makes it a dynamically allocated storage. This might take a while.
  9. Run .\VBoxManage.exe modifyhd "D:\VM\18.04\dynamic-18.04.vdi" --resize 65536 to have a 64GB drive. It'll be fast.
  10. Open Oracle VM VirtualBox Manager.
  11. Go to File -> Virtual Media Manager.
  12. Add the dynamic-18.04.vdi file.
  13. Close Virtual Media Manager.
  14. Right click on your VM (Ubuntu) and go to Settings.
  15. Select Storage tab.
  16. Select Controller: SATA.
  17. Select Add a Hard Disk.
  18. Select Choose existing Disk.
  19. Select dynamic-18.04.vdi.
  20. Start your VM.
  21. Open terminal.
  22. Run sudo apt install gparted
  23. Run gparted. It'll ask your password. Answer it correctly.
  24. Resize your partition. Make sure to Apply it.
  25. Be happy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment