Home > tutorial, ubuntu, virtual box, windows > How to resize a disk in VirtualBox 4.1 (ubuntu host/windows XP guest)

How to resize a disk in VirtualBox 4.1 (ubuntu host/windows XP guest)

In my previous post (https://myotragusbalearicus.wordpress.com/2011/04/28/how-to-resize-a-disk-in-virtualbox-ubuntu-hostwindows-xp-guest/) I discussed about resizing a virtual hard disk in VirtualBox 3.2.

Now, in the newer version of VirtualBox we have no “Create new virtual disk” option in the virtual device manager.

To resize a disk in VirtualBox is now much more easier… although you’ll have to use the command line.

First, list all of the virtual disks installed:

$ VBoxManage list hdds
UUID:        b8f8a160-d751-4a98-af16-5b6bd7174099
Parent UUID: base
Format:      VDI
Location:    /var/VirtualBox/HardDisks/WindowsXP.vdi
State:       created
Type:        normal
Usage:       WindowsXP (UUID: 6e027563-4bea-47e3-966e-067e3b563048)

That’s my 20GB hard disk drive.To resize it to 30GB:

$ VBoxManage modifyhd /var/VirtualBox/HardDisks/WindowsXP.vdi --resize 30720

And now, choose your application to extend the old partition to the new size.

It’s very easy with a LiveCD and GParted. Just choose Resize/Move and apply the changes.

An applause for VirtualBox, because in previous versions this was a little bit frustrating.

And don’t forget to read the documentation:

http://download.virtualbox.org/virtualbox/UserManual.pdf

  1. U'landia
    February 16, 2013 at 19:06

    Ok, I need to repartiion, but I need something different
    How to resize a disk in VirtualBox 4.1 (windows 8 host/Ubuntu 64bit 12.10 guest)

    I used vboxmanage modifyhd to resize the VDI to a larger size. It works fine, I can boot into Ubuntu, no problems. But my HD partition in Ubuntu is still the 8gb I started with not the 15gb I resized it to. So how do I resize the partition in Ubuntu.

    Thanks

    Like

    • February 16, 2013 at 19:20

      You must login to Ubuntu and use GParted to resize the partition, but first make a backup!

      Like

      • U'landia
        February 16, 2013 at 21:38

        Thanks for the help miquel, but I’m still having troubles, now with GParted. I installed it in Ubuntu, and then ran it, it shows me that I have 3 partitions, /dev/sda1, /dev/sda2 with /dev/sda5 that is the linux-swap. And then the unallocated partition. But there is no way I can figure how to add this unallocated space to /dev/sda1 (extend sda1 that is). Help would be appreciated.

        Like

      • February 18, 2013 at 9:41

        If the free space is not adjacent it’s not trivial.
        Look at this post, it’s similar to your question:

        http://askubuntu.com/questions/120347/how-can-i-add-space-from-unallocated-to-extended

        You have to start with a live CD and move /dev/sda2 and /dev/sda5 at the end of the free space, and then you can resize the /dev/sda1 to get the extra space.

        Hope this helps!

        Like

  2. March 9, 2012 at 17:50

    GREAT! Hint for those resizing WIN partitions. After running the above, your new .vdi file can be resized by starting virtual win, then Control Panel | Administrative Tools | Computer Management |Disk Management. Then simply merge your existing partition with the newly created one. No need to mess with GPARTED.

    Like

    • March 9, 2012 at 19:12

      Thanks Mark for your hint. I think it’s easier with Disk Management for those who use only windows.

      Like

  3. October 18, 2011 at 14:28

    It was nice to read your post. Thank you for posting this piece!

    Like

  1. No trackbacks yet.

Leave a comment