status of dm-crypt (alignment issues) on a SSD
Hello,
I'm about to install a laptop (using Debian Squeeze) that ships a SSD instead of a HDD for the first time (using GPT partitionning, then dm-crypt over a partition, then LVM2 to make a physical volume out of the crypto device, and logical volumes underneath).
I've done some searching/reading on the alignment issues involving SSD, and most threads end up stating that things will eventually work "out of the box" at some point. Most of them are quite old though, so I'd like to know what the status on this alignment issue is, and, if possible, what software versions are required for things to work properly (I understood that linux >= 2.6.33 was a good starting point, but what about cryptsetup, lvm2, util-linux, etc.?).
Here are the software versions I'm likely to find within the latest debian-installer snapshot:
- linux-image-2.6.32-5-amd64 2.6.32-28
- util-linux 2.17.2-3.3
- dmsetup 2:1.02.48-4
- lvm2 2.02.66-4
- cryptsetup 2:1.1.3-4
Any hint would be greatly appreciated (including pointers to up-to-date HOWTOs which I may have missed). Also, if you guys know which specific feature of linux 2.6.33 is required, it would allow me to check whether it's been backported to Debian's 2.6.32 or not.
Thanks a lot,
Signature · 1 line
mike dentifrice <[email protected]>
Quoted 4 lines · mike dentifrice
Any hint would be greatly appreciated (including pointers to up-to-date HOWTOs which I may have missed). Also, if you guys know which specific feature of linux 2.6.33 is required, it would allow me to check whether it's been backported to Debian's 2.6.32 or not.
i dont know about debian and which software version has which feature, but:
what you need on kernel side is having in sysfs
under /sys/block/<device>
queue/minimum_io_size
queue/optimal_io_size
queue/physical_block_size
on tool side,
for util-linux
ldd /sbin/fdisk | grep blkid
strings /lib/libblkid.so.1 | grep queue/
for lvm
strings /sbin/lvm |grep queue/
and so on.
Signature · 1 line
Luca Berra -- [email protected]
Quoted 5 lines · Luca Berra
what you need on kernel side is having in sysfs
under /sys/block/<device>
queue/minimum_io_size
queue/optimal_io_size
queue/physical_block_size
Just not all SSD presents proper values here.
My advice is align to 1MiB in such case and it will work:-) (this is default in recent versions - not all yet in Debian)
You can always do it manually, use fdisk -u (to work in sector mode, note sector is 512B. Switch off DOS mode if it is enabled - there should be warning)
For lvm, use pvcreate --dataalignment, then check with pvs -o +pe_start. (You can use --units S to work in sectors mode like in fdisk. 2048 sectors == 1MiB, any multiple of it is ok)
(See man page and check archive, I think it was described here several times.)
Milan
Thanks a lot for your reply!
Luca Berra a dit:
Quoted 5 lines
what you need on kernel side is having in sysfs
under /sys/block/<device>
queue/minimum_io_size
queue/optimal_io_size
queue/physical_block_size
These are present while running Debian's 2.6.32-5 linux kernel.
Quoted 3 lines
on tool side,
for util-linux
ldd/sbin/fdisk| grep blkid
$ ldd /sbin/fdisk | grep blkid
libblkid.so.1 => /lib/libblkid.so.1 (0x00007fd182e63000)Quoted 1 line
strings
/lib/libblkid.so.1| grep queue/
$ strings /lib/libblkid.so.1 | grep queue/ queue/minimum_io_size queue/optimal_io_size queue/physical_block_size
Quoted 2 lines
for lvm
strings/sbin/lvm|grep queue/
$ strings /sbin/lvm | grep queue/ queue/optimal_io_size queue/minimum_io_size
Quoted 1 line
and so on.
So far, everything seems good as far as I understnad, but should cryptsetup have 'queue' strings as well ? Mine (v1.1.3) doesn't. I compiled 1.2.0-rc1 and it doesn't either. Is that a stopper of not?
Thanks,
Signature · 1 line
mike dentifrice <[email protected]>
Quoted 3 lines · mike dentifrice
So far, everything seems good as far as I understnad, but should
cryptsetuphave 'queue' strings as well ? Mine (v1.1.3) doesn't. I compiled 1.2.0-rc1 and it doesn't either. Is that a stopper of not?
Grepping for queue is not clever idea, sorry.
1.1.3 has topology support, 1.2.0 adds 1MiB default here.
Run luksFormat --debug and you will see topology info read from kernel:
# Topology: IO (512/0), offset = 0; Required alignment is 4096 bytes.
512/0, offset = 0 means min io size / opt io size and offset from sysfs.
For ssd it should be surenly not 512 but something like write block.
Milan