Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to resize the disk space of an ubuntu guest in VMWare Workstation. After using the expand disk utility in vmware workstation, I need to do some linux magic to resize the parition. I have searched and found a lot of posts about resizing it. Unfortunately I don't really understand it all that well. Can anyone help me out with this?

jclawson@ubuntu:~$ df

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/ubuntu-root
                       7583436   5678136   1520072  79% /
udev                   1030884       152   1030732   1% /dev
none                   1030884         0   1030884   0% /dev/shm
none                   1030884        72   1030812   1% /var/run
none                   1030884         0   1030884   0% /var/lock
none                   1030884         0   1030884   0% /lib/init/rw
/dev/sda5               233335     39274    181613  18% /boot
.host:/              244035580  96519316 147516264  40% /mnt/hgfs


root@ubuntu:~# lvs
LV     VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
root   ubuntu -wi-ao   7.35G
swap_1 ubuntu -wi-ao 388.00M


root@ubuntu:~# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0009bea5

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1013     8136891   8e  Linux LVM
/dev/sda2            1014        1044      249007+   5  Extended
/dev/sda5            1014        1044      248976   83  Linux

I really appreciate the help.

share|improve this question

2 Answers 2

Back up your machine. Boot the system with GParted and grow the partition. Apply the changes.

Here is a video.

share|improve this answer
1  
gparted doesn't work on lvm's. If you look at my post... sda1 is an LVM. –  Jason Clawson Jun 4 '10 at 19:27
    
-1 It's running LVM and is virtualised, extending partitions with GParted is not the solution in this case. –  kaerast Jun 4 '10 at 22:30
1  
+1 People who search for things like "vmware ubuntu increase disk size" will come here. The answer is helpful for some of those. –  s.Daniel Oct 26 '13 at 13:51
up vote 7 down vote accepted

Ok, so after much toiling I finally figured out how to do it. And again, gparted cannot be used. Firstly, you should expand the size of the disk in VMWare Workstation. Boot into a livecd and open a root terminal:

We need to create a new primary partition of type LVM out of the free unused space.

#fdisk /dev/sda
#Command (m for help): n
#Command (m for help): p
#Command (m for help): 3
#Command (m for help): w

Reboot the vm into the live cd again

Create the phyisical volume:

#pvcreate /dev/sda3

Add the new volumn to the group:

#vgextend ubuntu /dev/sda3

Find out how much free space you want to expand to

#vgdisplay

Check what "Free PE/Size" equals and use that value in the next command

Extend the lvm and grow the file system into the new space

#e2fsck -f /dev/ubuntu/root
#lvextend -L +12.6G /dev/ubuntu/root
#resize2fs /dev/ubuntu/root

Done!

share|improve this answer
1  
+1 that sounds about right, or given this is all virtualised you could have just added a second disk and extended the lvm to that disk. –  kaerast Jun 4 '10 at 22:27

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.