[dm-crypt] Status of trim for SSds?

Milan Broz mbroz at redhat.com
Fri Jul 15 16:48:01 CEST 2011


On 07/15/2011 03:59 PM, Christian Hesse wrote:
> Ok, I do have a kernel with discard on dm-crypt support now. How do I
> set this option allow_discards for my device using dmsetup? dmsetup's
> manpage does not tell anything about it.

Backup your data, really. Note there could be still bugs.

You have to manually reload table with discard enabled for now,
it is quite complicated and dangerous because you will manipulate with
master key string directly:

1) Activate device using cryptsetup, remember active table for your device,
including key:

# dmsetup table <your_device> --showkeys

table will look like "0 1234 crypt aes-xts-plain64 <key> 0 8:2 8192"
(with different parameters according to your device,
do not forget --showkeys option)

2) Reload table with discard enabled, (add " 1 allow_discards"
to the end of table line)

# dmsetup load <your_device> --"<line above> 1 allow_discards"

3) activate new table

# dmsetup resume <your_device>

(check that dmsetup table again - it should print discard support now)

Alternatively, you can activate table directly (instead of cryptsetup)

# dmsetup create <your_device> --table "<line above> 1 allow_discards")

If you do not understand what are you doing here, please _wait_ until there
is official userspace support.

Any mistake here will cause data corruption or complete data loss!

Milan


More information about the dm-crypt mailing list