Expand disk space on Ubuntu 10.04 (VMWare Guest)

16,152

Solution 1

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!

Solution 2

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

Here is a video.

Share:
16,152

Related videos on Youtube

Jason Clawson
Author by

Jason Clawson

Updated on September 17, 2022

Comments

  • Jason Clawson
    Jason Clawson over 1 year

    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.

  • Jason Clawson
    Jason Clawson almost 14 years
    gparted doesn't work on lvm's. If you look at my post... sda1 is an LVM.
  • WheresAlice
    WheresAlice almost 14 years
    +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.
  • WheresAlice
    WheresAlice almost 14 years
    -1 It's running LVM and is virtualised, extending partitions with GParted is not the solution in this case.
  • s.Daniel
    s.Daniel over 10 years
    +1 People who search for things like "vmware ubuntu increase disk size" will come here. The answer is helpful for some of those.