- VirtualBox allows you to resize virtual disks to expand the storage available.
- You can do it through its graphical interface or through commands with VBoxManage.
- After resizing, it is necessary to adjust the partition within the guest operating system.
If you've ever run out of space on a VirtualBox virtual machine and are wondering how to expand its virtual disk without losing data, you've come to the right place. Increasing the size of a virtual disk may seem like a complicated process, but with the right tools, it's quite simple. In this article, we'll explain in detail how to resize a virtual disk in VirtualBox using different methods and tools.
Whether you prefer to use the VirtualBox graphical interface or run commands in the terminal, here you will find all the available options for expanding a virtual disk without risking data loss. We will also cover how to apply changes within the guest operating system to ensure that the additional space is properly available.
Why resize a virtual disk in VirtualBox?
When you create a virtual machine in VirtualBox, you need to define the size of the virtual disk. However, it is common to underestimate the amount of space needed to store programs, data, and updates. A virtual disk with little space can affect performance and limit functions within the guest operating system.
Some common reasons for increasing disk size in VirtualBox include:
- The guest operating system displays insufficient space warnings.
- Need to install new apps that require more storage.
- Improve the overall performance of the virtual machine.
Method 1: Using the VirtualBox graphical interface
Since VirtualBox version 6, an easier way to resize virtual disks from the Graphic interface, without the need to use commands in the terminal.
Steps to increase the virtual disk size:
- Open VirtualBox and go to the option File > Virtual Media Manager.
- In the list of disks, select the disk you want to expand.
- At the bottom of the window, adjust the disk size with the slider.
- Once you have set the new size, click on Apply.
This method is the fastest if your version of VirtualBox is supported, but it does not automatically perform the partition expansion within the operating system.
Method 2: Using the command line (VBoxManage)
If you prefer to perform the process manually or your version of VirtualBox doesn't have a graphical option, you can use VBoxManage, a command-line tool included with VirtualBox.
Steps to resize disk with VBoxManage:
-
- Shut down the virtual machine completely.
- Open the terminal or the symbol of the system en Windows (CMD).
- Run the following command to change the location to the folder where VirtualBox is located:
cd "C:\Program Files\Oracle\VirtualBox"
-
- Now, run the command to resize the virtual disk:
VBoxManage modifyhd "C:\Users\TuUsuario\VirtualBox VMs\MiVM\MiDisco.vdi" --resize 51200
- This command will increase the size to 50GBYou can change “51200” to the size in MB you need.
This method requires entering the exact path of the file .vdi
and it only works if the disk is dynamic or expandable type.
Adjust the operating system to recognize the new size
After increasing the virtual disk size, the guest operating system will still display the same amount of available storage. It is necessary extend the partition within the system.
For Windows:
- Open the Disk manager of Windows.
- Locate the expanded disk partition, right-click it, and select “Extend Volume.”
- Follow the wizard to allocate the additional space to the system.
To Linux:
- Start the virtual machine with a GParted Live CD.
- Select the disk partition and use the “Resize” option.
- Apply the changes and reboot the system.
Additional tips
Before making changes to the virtual disk size, it is recommended to follow these steps: good practice:
- Make a backup: Duplicate the file
.vdi
before starting to avoid data loss. - Check compatibility: The methods described only work with dynamic disks.
- Always expand the partition: Extending the disk without adjusting the partition will have no effect on the usable size.
Expanding a virtual machine's storage in VirtualBox is a simple process if you follow the proper steps. Whether using the graphical interface or the command line, making sure to adjust the partition within the operating system is key to taking advantage of the newly available space. By following this guide, you'll keep your virtual machine running smoothly and with enough space for future expansions.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.