Skip to contentSkip to conversation

HDD sector size interrelated with dm-crypt?

dm-crypt Lars Täuber 4 participants 4 messages Mar 17, 2011

lore
Share & tools
lore
#0 lore raw

Hi there,

does dm-crypt depend in any way on the sector size of the block device to be encrypted?
So the real question is: Does dm-crypt work as expected on a 4KiB sector sized SATA drive when there is no translation to 512B sector size? Are there options that must be taken then?

I've read somewhere that the encryption algorithm work with 512B block sizes. Could this be changed to 4KiB block sizes to gain speed with the upcoming devices?

Thanks
Lars

#1 lore raw

Should not matter. Also a speed increase is unlikely, disks are still dog-slow compared to things the CPU does, like encrypting sectors. They are not written/read individually anyways in most cases.

Arno

Quoted 15 lines · Lars T??uber

Hi there,

does dm-crypt depend in any way on the sector size of the block device to be encrypted?
So the real question is: Does dm-crypt work as expected on a 4KiB sector sized SATA drive when there is no translation to 512B sector size? Are there options that must be taken then?

I've read somewhere that the encryption algorithm work with 512B block sizes. Could this be changed to 4KiB block sizes to gain speed with the upcoming devices?

Thanks
Lars
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 7 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier 
#2 lore raw
In reply to Lars Täuber

Hi.

The definite source of info here is Milan but I guess:

Quoting Lars Täuber <[email protected]>:

Quoted 1 line

So the real question is: Does dm-crypt work as expected on a 4KiB sector sized SATA drive when there is no translation to 512B sector size? Are there options that must be taken then?

It uses 512B sectors for the encryption, but AFAIK it optimises all reads/writes depending on the device topology.

Quoted 2 lines

I've read somewhere that the encryption algorithm work with 512B block sizes. Could this be changed to 4KiB block sizes to gain speed with the upcoming devices?

No,.. and (although I'm not sure whether 4KiB would already be problematic) such high block sizes can cause security issues with some cipher modes (i.e. XTS).

Cheers,
Chris.

#3 lore raw
In reply to Lars Täuber
Quoted 9 lines · Lars Täuber

does dm-crypt depend in any way on the sector size of the block device to be encrypted? So the real question is: Does dm-crypt work as expected on a 4KiB sector sized SATA drive when there is no translation to 512B sector size? Are there options that must be taken then?

I've read somewhere that the encryption algorithm work with 512B block sizes. Could this be changed to 4KiB block sizes to gain speed with the upcoming devices?

dmcrypt always uses 512 bytes sector for encryption, it cannot be changed easily to 4k sectors (internal block layer bio structure and device-mapper always counts in 512 sectors).
I do not think that with accelerated encryption like AES-NI the speed up would be so visible.

But the whole stack (including device-mapper) properly aligns to drive sector size, so it will work with 4k drives without problems. I think many people is already using it on true 4k drives. In fact mapping sector is the block layer problem, device-mapper targets just propagates block size information up the stack.

Milan