Increase of virtualbox virtual hard disk-copy all content to a new hard disk

Source: Internet
Author: User
Tags gparted

 

The virtualbox virtual machine is indeed quite powerful, but its disadvantage is that its virtual hard disk size ceiling is fixed when it is created and cannot be expanded or reduced. I suffered a loss and set the virtual hard disk size to 6 GB. The result is not enough. What should I do? Re-assign a new disk, and then reinstall the system? Obviously, this is not desirable because it takes a lot of time. I couldn't find it online, but I found a better solution. The basic steps are as follows: 1. Create a new hard disk in the Media Manager of virtualbox. The size is large enough and I allocated 20 GB. 2. Download gparted livecd from the Internet (Web site: http://gparted.sourceforge.net/), I downloaded 0.5.2.9, as if the latest version still has a serious problem. 3. Introduce the ISO file of gparted livecd into virtualbox, load it in the virtual machine, and load the original virtual hard disk and the new virtual hard disk at the same time. I introduced the original disk to SATA 0, and the new disk to SATA 1. It must be noted that the boot of the optical drive should be set to priority. 4. the VM is started from the CD. When a problem occurs, press enter to enter a simple Linux GUI environment. 5. open the terminal Terminal Program (click the big icon at the top of the screen), and enter: dd If =/dev/SDA of =/dev/sdb. This is equivalent to the full copy of MBR, which takes a long time and requires patience. Note that/dev/SDA corresponds to the original disk and/dev/SDB corresponds to the new disk. Do not make a mistake. Otherwise, it will be too late to cry. You can see what the two disks correspond to in the gparted program. Make sure that you understand them before executing the command. 6. Restart the VM. 7. Open the gparted program and you can see that the partition size in the new disk is the same as that in the original disk. Obviously this is incorrect and you need to adjust the partition size. This adjustment process is simple and allows you to perform GUI operations intuitively. My situation here is that the new disk has two partitions, one primary partition is about 5 GB, And the other SWAP partition is about MB. Delete the swap partition first, then expand the primary partition to almost the maximum (leave around m for the swap partition), and finally re-allocate the swap partition. 8. Finally, do not forget to set the new disk as a ready-to-start disk in the gparted program. That is, a "Boot" item in "manage flags" should be selected. After completing the above steps, shut down the virtual machine, reconfigure the virtual machine, remove the disc and the original hard disk, use only the new disk, and then restart. As a result, the system on the new disk does work normally, and the content on the original disk is completely copied. It took nearly one hour and the migration was successful! Reference post: http://hi.baidu.com/jerry_916/blog/item/e0334553d6354e020cf3e38e.html

 

Original: http://www.cnblogs.com/BloodAndBone/archive/2010/11/04/1868783.html

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.