Recently, I bought a Samsung 850 Evo 500 GB SSD drive, as an upgrade to my Thinkpad X220. This post is yet another post of installing and aligning SSD partitions in ext4 filesystems. I have followed kargig's post on installing and aligning his SSD. This is simply a bunch of notes I kept during the procedure and not an explanatory post.

Before you start, you must find the Erase Block Size and Page size of the SSD. With a couple of searches in Google, I discovered that Samsung 850 EVO has the following values:
Erase Block Size: 1536kb
Page size: 8kb

I followed the same formula that kargig used to align the partitions. In my case, I used heads=96 and sectors=32

sudo fdisk -H96 -S32 /dev/sdb

The next step is to align the LVM accordingly.
Create a physical volume aligned to the Erase Block Size using the command

pvcreate --dataalignment 1536k /dev/sdb2

Then check the alignment of the physical volume:
pvs /dev/sdb2 -o+pe_start

The output of this command should be something like this
PV VG Fmt Attr PSize PFree 1st PE
/dev/sdb2 thinkpad lvm2 a-- 465,26g 0 1,50m

Note that the 1st PE starts from 1536k(1,50m), which is our goal here. Then proceed to create the VG and LVs you need:
vgcreate thinkpad /dev/sdb2
lvcreate -L 4G -n swap thinkpad
lvcreate -l 100%FREE -n root thinkpad

To align the ext4 partition, you have to set the proper values on stripe-width and stride options. I followed this recipe. In a nutshell:

stride = Page size / Filesystem block
stripe-width = Erase Block / Filesystem block

Filesystem block is 4kB (or 4096 bytes), so stride = 8 kB/4 kB = 2 kB and stripe-width=1536 kB /4 kB = 384 kB.
We create the ext4 partition using this command:

mkfs.ext4 -b 4096 -E stride=2,stripe-width=384 /dev/mapper/thinkpad-root

The last step is to copy data from the HDD to the SSD and change /etc/fstab on the SSD

mkdir -p /mnt/ssd
mount /dev/thinkpad/root /mnt/ssd/
mkdir -p /mnt/ssd/{dev,proc,sys,mnt}
cp -avp /dev/{console,random,urandom,zero} /mnt/ssd/dev/
rsync -aPEHv --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/mnt --exclude=/var/cach/apt/archives/ /mnt/ssd
vi /mnt/ssd/etc/fstab #Update /etc/fstab with the UUID of the root partition.
update-grub