You are not logged in.

#1 2013-09-16 07:13:35

pschyska
Member
Registered: 2013-09-16
Posts: 7

Correct partition alignment on SSD on a LUKS-LVM stack

Hi,

I'm having problems with my write speed on my SSD (Samsung SSD 840 Pro 256GB). Read speeds are normal at about 530MB/s, however write speeds are approximately halved with about 240-260MB/s - I got the full speed on Ubuntu though. I did trim the device with fstrim before measuring.

I freshly installed arch on a LUKS-LVM stack:
/dev/sda1 EFI
/dev/sda2 /boot
/dev/sda3 luks

Within luks I have a LVM with the following logical volumes:
/dev/arch/root
/dev/arch/swap

I was careful to align the /sda{1,2,3} paritions to 1MB

Number  Start      End        Size       File system  Name  Flags
        0.02MiB    1.00MiB    0.98MiB    Free Space
 1      1.00MiB    513MiB     512MiB     fat32              boot
 2      513MiB     1025MiB    512MiB     ext4
 3      1025MiB    241198MiB  240173MiB
        241198MiB  244198MiB  3000MiB    Free Space

I understood that both cryptsetup and pvcreate should auto detect the underlying device's geometry and care for proper alignment. FWIW, parted tells me all partitions are properly aligned:

[pschyska@pike:/tmp]
% sudo parted /dev/sda align-check opt 1      
1 aligned
[pschyska@pike:/tmp]
% sudo parted /dev/sda align-check opt 2
2 aligned
[pschyska@pike:/tmp]
% sudo parted /dev/sda align-check opt 3
3 aligned
[pschyska@pike:/tmp]
% sudo parted /dev/arch/root align-check opt 1
1 aligned
[pschyska@pike:/tmp]
% sudo parted /dev/arch/swap align-check opt 1
1 aligned

PE Start on the lvm is 1MB:

[root@pike ~]# pvs -o+pe_start
  PV              VG   Fmt  Attr PSize   PFree  1st PE 
  /dev/mapper/lvm arch lvm2 a--  234.54g 18.04g   1.00m

I think native partitions and LVM are "fine", maybe it's cryptsetup that is wrong? Any pointers how to check it?

Thanks,

Paul

Offline

#2 2013-09-16 20:57:16

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,257

Re: Correct partition alignment on SSD on a LUKS-LVM stack

Moved to Kernel and Hardware per original poster's request


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2013-09-17 20:06:27

pschyska
Member
Registered: 2013-09-16
Posts: 7

Re: Correct partition alignment on SSD on a LUKS-LVM stack

While reasearching about my SSD I realized it has full-drive-encryption and my machine has a TPM and an ATA password setting in the BIOS :-) With that, I can take LUKS probably out of the equation and will do a reinstall with LVM alone.
I would still be interested on how I can prove correct alignment.
I think my new partitioning scheme will consist of an EFI partition and a PV and within the LVM a single LV for /.
I know that I have to align to 1 MiB so for example
1MiB-200MiB EFI
200MiB-End   PV

and that I can check the alignment with parted blockdevice align-check opt. Also parted warned me when I left no space before the first partition that the alignment wouldn't be correct.

Can I trust parted? I read that there are some hints on "geometry" in sysfs, but I don't really know what to look for there.

LVM is supposed to have alignment-detection. Is this 100%, or do I have to take care of it manually (i.e. pvcreate ---dataalignment 1M)?

Thanks for any pointers

Edit: Machine is Lenovo Thinkpad X230, FWIW

Last edited by pschyska (2013-09-17 20:10:34)

Offline

Board footer

Powered by FluxBB