You are not logged in.

#1 2017-06-19 17:44:10

daankata
Member
Registered: 2017-05-21
Posts: 47

[SOLVED]Aligning SSD in Arch + LVM

I have read a lot of forums, wikis and blog posts regarding the alignment of SSD. I understood that most of today's modern disk tools in Linux align automatically (usually 1MiB).

But I have bought a SAMSUNG EVO 850 250GB, which Page Size is 8KiB and it's Erase Block Size (EBS) is 1536KiB. So I need to align it to 1.5MiB. So my questions are. Given the specifications of the SSD, what Partition Starting Offet would you recommend me? Is there need of addional aligning like 1.5MiB or 3MiB, or 1MiB would be fine? If no, how can I align my SSD in Linux to 1.5MiB Partition Starting Offset?

Also I am using LVM on LUKS. Do I need to manually align the partitions in LVM with:

pvcreate --dataalignment 1m /dev/sda

The LUKS container on top of the LVM would be already aligned
+-------------------------------------------------------------------------------------------------+
| Logical volume1       | Logical volume2       | Logical volume3          |   
|/dev/mapper/MyVol-swap |/dev/mapper/MyVol-root |/dev/mapper/M   | ----> Do I need to align them as well if /dev/sda2 is already aligned?
|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _| |
|                                                                                                   |
|                        LUKS encrypted partition /dev/sda2           
|                           ALIGNED                               
+--------------------------------------------------------------------------------------------------

Last edited by daankata (2017-06-19 18:26:17)

Offline

#2 2017-06-19 17:58:27

frostschutz
Member
Registered: 2013-11-15
Posts: 1,417

Re: [SOLVED]Aligning SSD in Arch + LVM

So I need to align it to 1.5MiB.

No. Aligning to pages is fine. Even if you aligned your partitions to 1.5MiB the filesystem itself would not respect it.

MiB alignment works for every device known thus far. (With the exception of old HDDs that had off-by-one jumpers set to make Windows aligned despite starting at sector 63.)

And that's what you get with every (current version of) tool nowadays. mdadm, luks, lvm, ... all do MiB alignment by default. Just make sure you don't get the partitions wrong and you're fine.

Last edited by frostschutz (2017-06-19 17:59:56)

Online

#3 2017-06-19 18:31:00

daankata
Member
Registered: 2017-05-21
Posts: 47

Re: [SOLVED]Aligning SSD in Arch + LVM

Thank you again:) So Physical volumes are aligned by default and I do not need to use pvcreate --dataalignment 1m /dev/sda. But do Logical volumes (/dev/mapper/MyVol-root) in LVM need to be aligned?

Last edited by daankata (2017-06-19 18:41:01)

Offline

#4 2017-06-20 17:05:19

frostschutz
Member
Registered: 2013-11-15
Posts: 1,417

Re: [SOLVED]Aligning SSD in Arch + LVM

In LVM, the PE size is usually multiple of MiB (e.g. 4 MiB) and 1st PE starts at 1MiB offset. So everything is MiB aligned. You can't create unaligned LVs with LVM, unless you specified very odd offsets / sizes on pv/vgcreate

Online

Board footer

Powered by FluxBB