[dm-crypt] Status of trim for SSds?

Christian Hesse list at eworm.de
Mon Jul 18 10:45:29 CEST 2011

Milan Broz <mbroz at redhat.com> on Fri, 15 Jul 2011 16:48:01 +0200:
> 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.

I do have good backup. Really. ;)

> 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!

If I understand correctly the table reload suspends my device? With the root
partition inside the crypt device I would have to do this in initram disk I
Perhaps I really should wait for support in cryptsetup. :D

However... Thanks a lot for your work and the quick response!
Schoene Gruesse

More information about the dm-crypt mailing list