Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a VM that I originally gave 10 GB to (using VMware workstation, and Ubuntu 11.10 is the guest OS).

I now wish to add to that. I have seen the option to expand the disk size, but all that does is create a new "partition" that Ubuntu can see.

Is there a way to expand the size of the primary partition that the guest OS is using?

NOTE: I have seen something regarding doing this for a regular Ubunbu OS that requires a boot disk. Is there a way that I can apply that to this VM case?

Using Windows 7 64-bit as the host OS

EDIT: To be clear, I am trying to resize the boot partition.

Edit 2: GParted's resize option is greyed out.enter image description here

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Adding disk space using the VMWare program is like buying a new hard drive, and copying your Ubuntu partition to the new drive; you now have more space, but the partition for the OS is the same size.

Now you can make that partition bigger just like you would with a normal disk. You can run gparted and grow the partition fairly easily. If you've never used it, it's pretty straightforward to do, and if it's not installed already, you can get it from the standard repository.

Edits:

One thing I forgot is that you can't resize a mounted partition. So, if it's your main installation, you can't really unmount it - you will need to boot the VM from a linux CD that has gparted, such as the live installation CD, and use gparted on the CD to resize the disk in the VM.

Since you installed Ubuntu, you probably know how to boot the VM from a CD (press F2 during boot to get to the "BIOS", and make sure the CD is set as the first bootable drive); but instead of installing the OS, you run gparted, and choose the disk, which should be available as /dev/sda.

Also, since you have the swap file in the middle, you'll need to turn off the swap, delete it, and then add a swap partition at the end. You can create a swap partition at the end of the free space before deleting the current swap, if you're worried about not having a swap file. Probably, though, the swap isn't used during all this.

After some discussion, we discovered one more gotcha. The OS was on a primary partition, but the swap and the extra space was on an extended partition. So, the extended partition needed to be deleted, then the unallocated space shrunk to make room at the end for the swap drive. After this, the main partition is free to grow as a bigger primary partition.

share|improve this answer
    
The option to resize the partition is greyed out. See edit for screenschot. –  soandos Apr 1 '12 at 4:01
    
Sorry, I forgot that it won't work while the partition is mounted; you would normally boot from a live CD such as the installation disk or a utility CD. You still can with the VM; you will need to mount the CD drive, and have the CD in the drive when you start the VM. I think it should work normally. You will run gparted from the CD, and choose the main drive (the VM drive) for partitioning. –  Marty Fried Apr 1 '12 at 4:05
    
Where can I get such a disk image? –  soandos Apr 1 '12 at 4:07
    
I have the image, but am having trouble booting into it. How can I do that? –  soandos Apr 1 '12 at 4:14
    
The one with gparted? If you don't have a live install CD, you can make a gparted bootable CD from here: gparted.sourceforge.net/livecd.php –  Marty Fried Apr 1 '12 at 4:16

It's actually just adding unpartitioned space to the disk. If the Ubuntu install is using LVM, you can add the new space to the existing pool. If not, you can use a tool such as Gparted to increase the size of existing partitions. Be careful.

share|improve this answer
    
I attempted to use disk utilites and that did not work. Trying GParted now. –  soandos Apr 1 '12 at 3:50
    
In GParted, the option to resize the current partition is greyed out. –  soandos Apr 1 '12 at 3:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.