Resize your existing disk in VMware Client (using an GParted ISO), and then reboot the virtual host. Then login and check new partition size:
  • parted /dev/sda print

Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 255MB 255MB primary ext3 boot
2 255MB 2147MB 1892MB extended
5 255MB 2147MB 1892MB logical lvm


Information: Don’t forget to update /etc/fstab, if necessary.

Create new partition from available space. Start with the last end size (2147MB) and end with the total disk size (64.4GB).

  • parted /dev/sda "mkpart primary 2147MB 64.4G"
Check newly created partition:

  • parted /dev/sda print
Disk /dev/sda: 64.4GB Sector size (logical/physical): 512B/512B Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 255MB 255MB primary ext3 boot
2 255MB 2147MB 1892MB extended
5 255MB 2147MB 1892MB logical lvm
3 2147MB 64.4GB 62.3GB primary


Information: Don’t forget to update /etc/fstab, if necessary.

Create the physical volume from your new parition:

  • pvcreate /dev/sda3
Physical volume “/dev/sda3″ successfully created

Check newly created physical volume:

  • pvdisplay /dev/sda3
— NEW Physical volume --
PV Name /dev/sda3
VG Name
PV Size 58.00 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 7gsSxU-Vsf7-QpJp-ZPlR-a3BG-x1b8-tz4pyV



  • pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 lvm2 — 58.00G 58.00G
/dev/sda5 ubuntu lvm2 a- 1.76G 0


Extend your existing volume group with the newly created physical volume

  • vgextend ubuntu /dev/sda3
Volume group “ubuntu” successfully extended

Check it:

  • pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu lvm2 a- 58.00G 58.00G
/dev/sda5 ubuntu lvm2 a- 1.76G 0


  • vgdisplay

— Volume group --
VG Name ubuntu
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 59.75 GB
PE Size 4.00 MB
Total PE 15297
Alloc PE / Size 450 / 1.76 GB
Free PE / Size 14847 / 58.00 GB
VG UUID 5hZbAz-0AgU-I0ui-WNvs-2IgD-IjKi-5sHKi4


Now extend your logical volume with the free PE space (14547):

  • lvextend -l +100%FREE /dev/ubuntu/root
Extending logical volume root to 59.62 GB
Logical volume root successfully resized

Resize your root volume (can be done on a live sysyem):

  • resize2fs /dev/ubuntu/root
resize2fs 1.40.8 (13-Mar-2008)
Filesystem at /dev/ubuntu/root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 4


Performing an on-line resize of /dev/ubuntu/root to 15628288 (4k) blocks.

Perform a e2fsck on your root system, if needed. Or just reboot your server, which is safer as it will check the filesystem while it’s not mounted.
 


Comments


Your comment will be posted after it is approved.


Leave a Reply