Adjust Virtual Box hard disk size

Source: Internet
Author: User

 

I use Virtual Box on Mac to install Win7 Virtual machine. Because we have installed Windows 7 32-bit. Now, because the machine memory is increased to 8 GB, we can draw 4 GB to support the Win7 virtual machine. So we re-installed the 64-bit version of Win7. When creating a VM's hard disk, I chose the default Virtual Box capacity of 20 GB. I can see that Virtual Box tells us that the hard disk capacity can be dynamically adjusted. Who knows this is actually misleading. The so-called dynamic adjustment cannot exceed the set value, that is, 20 GB is the upper limit of storage allocation. Dynamic Allocation is actually a way to save disk space. This means that when we create a virtual machine's hard disk, we can set it to large enough. As long as the hard disk is not used up, the space can be shared by the host. The 64-bit version of Win7 occupies much more hard disk space than the 32-bit version. After the operating system is installed, there is not much space left. After SQL Server 2008 is installed and Visual Studio 2010 is fully installed, the space is insufficient. I previously thought that the hard disk capacity could be dynamically adjusted, so when Visual Studio prompts that the space capacity is insufficient, I still select "continue" and the installation result is incorrect.

 

So how can we solve this problem? Are you sure you want to reinstall it? It's so sad. Although no software has been installed, it takes a long time to install the operating system and database. So I tried to resize the Virtual Box hard disk. However, in the Virtual Box management tool, the option to change the disk size is not found. Through Google, I found a way to modify the disk space through the command line, provided that the Virtual Box version must be 4.0 or later.

 

This command:

 

VBoxManage modifyhd uuid-resize 40960

 

40960 is the capacity you want to adjust, that is, 40 GB. The uuid in the command can also be replaced by the vid file name. However, my file name unfortunately contains spaces. Double quotation marks or "/" may support space file names, but I didn't try it because uuid is a better method. As for the command line input, in Mac, enter the command line directly under Terminal. When Virtual Box is installed, VBoxManage is added to the path. Terminal can identify this command.

 

To use uuid, You need to obtain the uuid of the current virtual machine. It cannot be obtained in the management tool. Therefore, we should obtain it through the command line:

 

VBoxManage list hdds

 

This command displays all virtual hard disks. You can use Location to determine the hard disk you want to adjust. After obtaining the uuid, you can adjust the hard disk size through modifyhd. Note that you must disable the VM before adjusting the hard disk.

 

Note: After I adjusted the disk space through the modifyhd command, I checked the vid file through the management tool. The capacity did change and the expected results were achieved. So I think it's okay. You can see that the disk C is still 20 GB after you open the Virtual Machine in Virtual Box. This makes me feel depressed. So I thought, maybe there are some other settings in Virtual Box. However, the management menu of all Virtual boxes cannot be found. I even removed the reference to the vid file in Storage and reloaded it, but it remains unchanged. I tried restarting the Virtual Box and even restarting the computer. What exactly is the problem? I was wondering why I was trying to delete the Virtual Machine and reinstall it. However, it is chilling to install the operating system and related software. Therefore, I plan to return to the Virtual Box and add a disk for it. As a result, after adding the disk, start the VM and find that the new disk is not added to the computer. Suddenly, I thought about whether it was a problem with disk partition management in Computer Management. Therefore, open "disk management" in "Computer Management" in Win7, and find that the newly added disk is displayed as unallocated, while the original disk capacity is 40 GB, however, 20 GB is not allocated. So I chose to extend the disk. The missing 20 GB disk was found. The Virtual Box hard disk size was successfully adjusted.

 

Therefore, after adjusting the disk using the Virtual Box command, you must remember to extend the disk in the Win7 operating system. This is like you have added a new disk to your computer, and you need to perform the same operation.

Zhang Yi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.