The other answers I feel are not comprehensive enough and leave room for error.
Here is an actual working example of recovery with a minor caveat I have not seen mentioned anywhere.
When taking the sector start and size from /sys/block/sda/* you have to remember to subtract 1 from the size or you will be 1 sector off.
Also remember in fdisk to hit "u" for sector mode.
Here is the example I succesfully followed:
Step 1 -Find your device directory in /sys/block/sda/sda1 (change the /sda and /sda1 to match your disk device name and partition number).
You have to do a cat on the 'start' and 'size' which represents the starting sector of the partition and the 'size' represents how many sectors it is.
take the size value and subtract 1 from it or you will not get the original or correct result
fdisk /dev/sda
press u to change to sectors which is what /sys/block/sda goes by
/sys/block/sda
[root@server1 sda]# cat sda1/start
2048
[root@server1 sda]# cat sda1/size
1024000
[root@server1 sda]# cat sda2/start
1026048
[root@server1 sda]# cat sda2/size
1464121344
Step 2 -Use fdisk to take the above sector information and input it (remembering to subtract 1 from the size when telling fdisk the end sector)
"Press u" to switch to sector mode once you run:
fdisk /dev/sda
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-1465149167, default 63): 2048
Last sector, +sectors or +size{K,M,G} (2048-1465149167, default 1465149167): +1023999
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First sector (63-1465149167, default 63): 1026048
Last sector, +sectors or +size{K,M,G} (1026048-1465149167, default 1465149167): +1464121343
#
http://realtechtalk.com/Linux_How_To_Recover_Partition_Table_from_Kernel_and_Restore_CentosDebian_etc-1772-articles