Change Size of Virtual Disk

This is for discussing general topics about how to use VirtualBox.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Change Size of Virtual Disk

Post by loukingjr »

this looked like it might be a good place to ask my question. I have a crunchbang statler guest with two partitions. the / partition is already full because apparently when I first installed it the installer made the /home partition over two times larger than /. so in reading things I thought maybe I should just clone it to a larger VD but first I tried gparted to resize the partitions. well it seems it won't let me grow or move the / partition at all, even though there's 12.5 GB of free space.

so my question is, if I clone the drive to a larger one, am I still going to be stuck with a full / partition?

thanks
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Change Size of Virtual Disk

Post by Sasquatch »

Pretty much, because all you do is make the end further away. Since your / is probably before your /home, all you get is space after /home, but not after /. What your problem is, is that /home is in an extended partition. You have to change it's size too before the primary partition / can be changed.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Change Size of Virtual Disk

Post by loukingjr »

Sasquatch wrote:Pretty much, because all you do is make the end further away. Since your / is probably before your /home, all you get is space after /home, but not after /. What your problem is, is that /home is in an extended partition. You have to change it's size too before the primary partition / can be changed.
thanks
/home is in an extended partition. can I resize that or should I just re-install?
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Change Size of Virtual Disk

Post by Sasquatch »

Read what I wrote a bit better. Then Google for the terms I've used if you have no idea what they mean.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Change Size of Virtual Disk

Post by loukingjr »

Sasquatch wrote:Read what I wrote a bit better. Then Google for the terms I've used if you have no idea what they mean.
well, I thought I had tried to resize the extended partition before. I will take a look at it again.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Change Size of Virtual Disk

Post by loukingjr »

Sasquatch wrote:Read what I wrote a bit better. Then Google for the terms I've used if you have no idea what they mean.
okay, I have it all sorted out. because I couldn't move/resize the extended partition the first time I tried, I thought you were saying because they were in an extended partition it was going to be a "problem" to fix. I guess I did something wrong in gparted the first time around because everything worked fine the second time.

thanks
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
madmac88
Posts: 2
Joined: 23. Jan 2009, 20:19
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux, Windows Server 2003/2008

Re: Change Size of Virtual Disk

Post by madmac88 »

I got a VDI with Linux on it that was getting a little tight on space and here's how I expand the VDI (let's call this VDI-1):

1. Create a new VDI (VDI-2) with the desired size
2. Run another Linux guest with VDI-1 and VDI-2 attached as additional storage devices
3. Duplicate the old disk with:

Code: Select all

dd if=[VDI-1 device] of=[VDI-2 device] bs=1M conv=noerror
4. Use GPartEd to move/enlarge your partitions
5. Shutdown the guest Linux system and detach VDI-1 and VDI-2
6. Change the storage device for the old Linux guest from VDI-1 to VDI-2

A bit tedious, but it gets the job done for me. Of course, it helps that I always have a few Linux guest systems around. :)

P.S. Beware that the UUID of the new VDI is the same as the original VDI. I just deleted the old one once I confirmed that it was working, so this didn't matter to me.
Post Reply