How to resize a Virtual Hard Disk in VirtualBox

Page 1 of 3 123 LastLast

  1. TE7
    Posts : 35
    Microsoft Windows 7 Home Premium 64-bit SP1
       #1

    How to resize a Virtual Hard Disk in VirtualBox


    You can use the following link to resize your virtual hard disk:

    Trivial Proof: Resizing a VirtualBox Virtual Hard Disk

    Tips:

    1. For a dynamic size virtual hard disk, you can just use the VBoxManage modifyhd --resize command, as explained in the link.

    2. For a fixed size virtual hard disk, you must first clone the virtual hard disk, and then resize the clone, as explained in the link. When you clone a fixed disk, the clone is a dynamic sized disk by default.

    Emphasize: You cannot just resize a FIXED size virtual disk.

    2a. You can then replace the original virtual hard disk with the clone in the settings for the virtual machine in:

    In the VirtualBox settings for the virtual machine (Settings --> Storage --> Controller for the .vdi file --> click the round disks button in the top right to choose which .vdi to boot from).

    2b. You can then go to:

    In the main VirtualBox window, File --> Virtual Media Manager, and delete the old .vdi file (Remove option).

    Note: When you resize, the number you give to the command is in megabytes, so in my case I wanted to resize from 8 GB to 12 GB, so I used --resize 12288.

    3. If the host is Windows, here are some tips:

    - Use Windows Explorer to go to the folder that contains the .vdi file to work on.

    - Hold down the shift key, right click, and choose Open Cammand Window Here.

    - When using VBoxManage, all paths and file names that contain spaces must be enclosed in quotations.

    - For example, in my case I had to use:

    - "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd "Ubuntu 11.10 64 bit.vdi" "Ubuntu 11.10 64 bit clone.vdi" --existing

    - The same applies for the VBoxManage modifyhd --resize command.

    4. If you are cloning linux, and then resizing, and then using GParted afterward, as explained in the link, here are some tips:

    - In my case, I had a swap partition. What I did was to delete the swap partition, resize my cloned partition (leaving enough space to add the swap back again afterwards), and then added a new swap partition at the end of the virtual hard drive. I found this the easiest way to do it.

    5. For cloning, there's an option for it in the Virtual Media Manager (Copy option, I guess), but I didn't try it yet. That might be easier, as I've read online.

    I hope these tips are helpful.
      My Computer


  2. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #2

    There is a utility that can do this sort of thing via a GUI. CloneVDI
      My Computer


  3. TE7
    Posts : 35
    Microsoft Windows 7 Home Premium 64-bit SP1
    Thread Starter
       #3

    I checked out the link. Looks good. After the clone I think you still might need to use GParted, though. I'm not sure. Any thoughts on that?
      My Computer


  4. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #4

    Yes you would have to resize the partitions but I guess you would have to do that with VboxManage. How successful that would be would depend on the OS. I have had problems with Linux not recognizing that a disk had increased in size.
      My Computer


  5. TE7
    Posts : 35
    Microsoft Windows 7 Home Premium 64-bit SP1
    Thread Starter
       #5

    I think that's what using GParted does. After I had cloned, then resized the clone, I used GParted to increase the new clone size in the partition within the virtual disk. When you clone, and then resize, it just increases the size of the virtual disk, not the partition containing the virtual OS. GParted lets you increase the size of the OS partition inside the virtual disk. Before using GParted, when I booted the clone, System Monitor showed the same size as the original. But after using GParted, the new size was reflected in the clone.
      My Computer


  6. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #6

    Yes. I think the problem I had was that I moved a partition and Linux didn't like it, but then I'm not an expert on either partitioning or Linux.
      My Computer


  7. TE7
    Posts : 35
    Microsoft Windows 7 Home Premium 64-bit SP1
    Thread Starter
       #7

    I tried the CloneVDI tool to increase the size of a Linux (Lubuntu) virtual drive. It cloned and gave me a new DYNAMIC sized .vdi file. I chose to increase the partition size, along with the virtual disk size, but the result was no OS partition increase. I think the presence of the swap file may have confused that aspect of it. I still had to use GParted to increase the size of the the OS partition to max out the size of the new cloned virtual disk.
      My Computer


  8. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #8

    If I remember correctly I didn't ask it to increase the partition size and then when I tried to resize the partition in openSUSE it showed no room for expansion and the old disk size. I think the problem lay in the default partition layout in openSUSE. Swap, System partition, Data partition. When I tried with a bootable GParted I increased both the system and data partition which of course involved moving the data partition. openSUSI wouldn't boot so at that point since it was a new install I just reinstalled with the new partition sizes.
      My Computer


  9. TE7
    Posts : 35
    Microsoft Windows 7 Home Premium 64-bit SP1
    Thread Starter
       #9

    I haven't tried the process with a separate data partition. I've just tried once with the command line (Ubuntu) and once with CloneVDI (Lubuntu). Both of those virtual machines didn't have a separate data partition. I can see how that gets tricky if you move the partitions instead of just resizing from end of one partition.
      My Computer


  10. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #10

    It's an interesting setup. Although I called it a data partition it also holds any programs you have installed just leaving the first partition entirely for the OS.
      My Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 23:56.
Find Us