[dm-crypt] cryptsetup alignment

Milan Broz gmazyland at gmail.com
Sat Jun 29 10:47:28 CEST 2013

On 29.6.2013 5:21, Christoph Anton Mitterer wrote:
> Hi Milan, et al.
> Can I find out why cryptsetup created my LUKS devices with a payload
> offset of 4096?
> I mean these are 512B sectors right?... I though all tools would
> nowadays align to 1 MiB  but that would be 2048 S.

If there is enough space for keyslots then it is 1MiB.

If 1MiB is too small, it uses multiple of default alignment, here 2MiB
(See LUKS design document for exact info how keyslot is used.)

I am almost sure you used XTS with 512bit key, that's exactly this case
- 1MiB is not enough for it.

Try to use 256b key for XTS (e.g. default) and you will get 2048s.

(BTW this is one of the reason we stick with 256bit XTS -> AES128
to not increase LUKS keyslots size. For other reasond please seach
this list - this discussion was surely here.)

> Is it _really_ that smart that it auto detected this and also included
> the LVM's PE size into it's calculations?

No. Nothing is so smart as LVM :-]
It is just plain round up to multiple of requested (default) alignment.


More information about the dm-crypt mailing list