To increase the disk size of a VirtualBox VM, follow these steps:
- Shut Down the VM: Ensure the VM is turned off before proceeding.
- Resize the Virtual Disk:
- Open a terminal (or command prompt) on your host machine.
- Navigate to the directory where the VirtualBox installation is located (e.g.,
C:\Program Files\Oracle\VirtualBoxon Windows). - Run the following command to resize the disk. Replace
<size_in_MB>with the desired size in MB and<path_to_vdi_file>with the path to your VM’s VDI file:VBoxManage modifyhd "<path_to_vdi_file>" --resize <size_in_MB>For example:VBoxManage modifyhd "C:\Users\YourUsername\VirtualBox VMs\YourVM\YourDisk.vdi" --resize 20480 - Note: This only works for VDI and VHD files, not VMDK files.
- Expand the Partition within the VM:
- Start your VM.
- Open the Disk Management tool if you’re using Windows as the guest OS:
- Right-click on the Start Menu and select Disk Management.
- Find your newly resized virtual disk and extend the partition into the unallocated space.
- For Linux guests, use
GPartedor similar partition management tools to expand the partition into the unallocated space.
After following these steps, your VirtualBox VM should recognize the increased disk space.
