Two Methods to Grow A VirtualBox Disk Image (.vdi)

preview_player
Показать описание
#VirtualBox #VM #DiskImage #VDI

NOTE: Make a backup copy of the .vdi before attempting these steps
 
In this example, we'll be taking an 8GB Raspberry Pi OS VirtualBox VM and increasing the .vdi disk size to 32GB
 
Method 1: Increasing the .vdi size
This method requires that the virtual disk be dynamically allocated. If the .vdi is fixed size the size cannot be changed and VirtualBox will throw an error when you try to resize it
 
   01. Launch VirtualBox Manager
   02. Select File ≫ Virtual Media Manager
   03. Find and click the .vdi file to increase in size
   04. Change the size at the bottom of the dialog window
   05. Click Apply and then Close
   07. Back in VirtualBox Manager, right click the VM using the resized .vdi ≫ Settings...
   08. Select Storage from the left navigation pane
   09. Click on or add a new optical drive
   10. Select the disc dropdown to the right ≫ Choose a virtual optical disc file...
   11. Browse to and select the downloaded GParted .iso file
   12. Click OK
   13. Make sure the VM using the resized .vdi is selected and click Start ≫ Normal
   14. If prompted, press a key to boot to the CD-ROM
   15. GParted should begin loading
   16. Follow the prompts to set a keyboard layout and language
   17. GParted will automatically start once the desktop environment is displayed
   18. In the top right corner, select the correct device identifier to work with (ie /dev/sdb)
   19. In the middle section of the interface, right click the partition to resize ≫ Resize/Move
   20. Drag the slider or set the numerical values to set the new partition size ≫ Click Resize
   21. Click the check mark icon at the top center of the interface to Apply All Operations
   22. Once the resizing has completed, shutdown the VM
   23. Back in VirtualBox Manager, right click the VM ≫ Settings...
   24. Select Storage from the left navigation pane
   25. Click on the optical drive
   26. Select the disc dropdown to the right ≫ Remove Disk from Virtual Drive
   27. Click OK
   28. Make sure the VM is selected and click Start ≫ Normal
   29. The VM should boot normally with the OS showing the additional storage available
 
Method 2: Cloning to a new, larger .vdi
This method can be used on either fixed size or dynamically allocated virtual disks
 
   01. Launch VirtualBox Manager
   02. Select File ≫ Virtual Media Manager
   03. Click the Create icon at the top left of the dialog window
   04. Select VDI ≫ Next
   05. Select Dynamically allocated ≫ Next
   06. Set the file location and disk size ≫ Create
   07. Click Close
   09. Back in VirtualBox Manager, right click the VM ≫ Settings...
   10. Select Storage from the left navigation pane
   11. Click the Controller to select it ≫ Add Hard Disk...
   12. Find and select the .vdi created previously ≫ Choose
   13. Click on or add a new optical drive
   14. Select the disc dropdown to the right ≫ Choose a virtual optical disc file...
   15. Browse to and select the downloaded GParted .iso file
   16. Click OK
   17. Make sure the VM using the resized .vdi is selected and click Start ≫ Normal
   18. If prompted, press a key to boot to the CD-ROM
   19. GParted should begin loading
   20. Follow the prompts to set a keyboard layout and language
   21. Once the desktop environment loads, minimize the GParted application
   22. Launch the terminal application from the desktop
   23. Run the following commands making absolutely certain the source/if and destination/of are input correctly in the dd command
         # output disk information, note the disk identifier for the source and destination targets
         sudo fdisk -l
         # use dd to clone the source to the destination
         dd if=/dev/sda of=/dev/sdb bs=4M status=progress
   24. Once dd has completed, restore the minimized GParted application
   25. In the top right corner, select the new larger device identifier to work with (ie /dev/sdb)
   26. In the middle section of the interface, right click the partition to resize ≫ Resize/Move
   27. Drag the slider or set the numerical values to set the new partition size ≫ Click Resize
   28. Click the check mark icon at the top center of the interface to Apply All Operations
   29. Once the resizing has completed, shutdown the VM
   30. Back in VirtualBox Manager, right click the VM ≫ Settings...
   31. Select Storage from the left navigation pane
   32. Click on the optical drive
   33. Select the disc dropdown to the right ≫ Remove Disk from Virtual Drive

....Full steps can be found on GitHub [link at the top]

### Connect with me and others ###
Рекомендации по теме