Extend VM HardDrive Centos 6

Totally copied this from elsewhere, but the instructions were precise so I am re-posting this here so I can easily find it next time.

The below steps extended my partition from 45G to 100GB on a VMWare EXSi 5.5 running Centos 6.

1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:

fdisk -l 2) Get list of partitions for /dev/sda device:

ls -al /dev/sda*

brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2

3) Create new primary partition

fdisk /dev/sda

Then type:
n (enter) [create new partition] p (enter) [primary partition] 3 (enter) [next available number from listed /dev/sda partitions in 2) (enter) [start cylinder] (enter to use all available physical space) or specify size in +cylinders, +size{K,M,G} t (enter) [change partition type] 3 (enter) [selecting /dev/sda3 partition] 8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types] w (enter)

The partition table has been altered!

4) Reboot Centos 6.X then log back in with root privileges

reboot

5) Check the new partition is ready and type '8e':

fdisk -l

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2089 16264192 8e Linux LVM /dev/sda3 2089 3916 14678054 8e Linux LVM

6) Create physical volume:

pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created
7) Find out volume group name:

vgdisplay

--- Volume group --- VG Name vg_app1
... 8) Extend the physical volume:

vgextend vg_app1 /dev/sda3

Volume group "vg_app1" successfully extended

9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lvroot in vgapp1 volume group.

lvextend -l +100%FREE /dev/vgapp1/lvroot

Size of logical volume vgapp1/lvroot changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized

10) Resize logical root volume:

resize2fs /dev/vgapp1/lvroot

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vgapp1/lvroot is mounted on /; on-line resizing required
old descblocks = 1, newdescblocks = 2
Performing an on-line resize of /dev/vg
app1/lvroot to 6718464 (4k) blocks.
The filesystem on /dev/vg
app1/lv_root is now 6718464 blocks long.
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.

11) Check available space:

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgapp1-lvroot 100G 40G 58G 42% / tmpfs 9.8G 0 9.8G 0% /dev/shm
/dev/sda1 477M 88M 364M 20% /boot