Q: extend unallocated disk to an existing lvm im using vmware on my ubuntu server, initial setup was 10GB disk utilization, increased it to 15GB using lvextend and added another 5GB for a total of 20GB.
below displays my fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002948a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    20969471    10233857    5  Extended
/dev/sda3          499712      501757        1023   83  Linux
/dev/sda4        20969472    31457279     5243904   8e  Linux LVM
/dev/sda5          501760    20969471    10233856   8e  Linux LVM

/dev/sda4 is actually an extension of my /dev/sda5
root@media:~# pvscan
  PV /dev/sda5   VG media   lvm2 [9.76 GiB / 0    free]
  PV /dev/sda4   VG media   lvm2 [5.00 GiB / 0    free]
  Total: 2 [14.76 GiB] / in use: 2 [14.76 GiB] / in no VG: 0 [0   ]

i still have unallocated disk somewhere in my /dev/sda as stated above and i want to use it.
but when i create a new partition in my fdisk /dev/sda to get the additional 5GB, i get this 1023 blocks instead. 
Device Boot      Start         End      Blocks   Id  System
/dev/sda3          499712      501757        1023   83  Linux

by ignoring above, and creating another partition on my /dev/sda
this shows..
All primary partitions are in use
Adding logical partition 6
No free sectors available

i cant seem to create another partition without this
/dev/sda3          499712      501757        1023   83  Linux
happening. can someone assist what im doing wrong?
basically, what i had in mind is to gradually increase the partition size of my server.
from 10 + 5 + 5 + so on...
windows was able to extend unallocated space without any problems and rebooting. im very new to linux and i hope someone would help me understand whats happening in my issue.
root@media:~# pvs
  PV         VG    Fmt  Attr PSize PFree
  /dev/sda4  media lvm2 a-   5.00g    0
  /dev/sda5  media lvm2 a-   9.76g    0

root@media:~# lvs
  LV     VG    Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  root   media -wi-ao 13.76g
  swap_1 media -wi-ao  1.00g

root@media:~# vgs
  VG    #PV #LV #SN Attr   VSize  VFree
  media   2   2   0 wz--n- 14.76g    0


A: Why not make your life easier and use LVM for the extension? 
If I was on your place, I would backup the data from the server (20 GB are not much at all), then:
umount <respective mount point>
lvremove media
vgremove media
pvremove /dev/sda4
pvremove /dev/sda5

Partition /dev/sda:
    fdisk /dev/sda
    p -> print 
    d 5 -> delete /dev/sda5
    d 4 -> delete /dev/sda4
    d 3 -> delete /dev/sda3
    d 2 -> delete /dev/sda2
    p -> print to confirm your changes
    n -> create new partition, take the defaults to acquire the max disk space possible for it, choose primary partition (LVM will manage it afterwards)
    t -> change the type of the partition to LVM
    w

As /dev/sda1 is in use the changes will be visible after reboot. Then fdisk -l /dev/sda will output:
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002948a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          499712    20969471    10233857   8e  Linux LVM

Add /dev/sda2 to LVM, create volume group and partition:
pvcreate /dev/sda2
vgcreate media /dev/sda2
lvcreate --size 14G --name root media
lvcreate --size 1G --name swap_1 media (in my experience `--extents` is more precise than `--size`. Verify by `vgdisplay` there are no Free Extents)
Create filesystems and enable swap for the newly created logical volumes.

Advantage of this setup: flexibility. The logical volume size may be smaller than the volume group, hence the filesystem will be smaller too. Then to increase the size, use lvextend and increase the filesystem afterwards.
Disadvantage: have to delete all partitions, backup and restore the data.
