I’m currently building a new Ubuntu 13.04 server with 2 256GB SSDs in a raid mirror to run a MariaDB instance. We typically place LVM on top of dm-crypt encryption on top of an md raid 1 array, but haven’t used SSDs in this setup previously.
My question is, since we’ll be using a newer (3.8) kernel, it should allow fstrim to be applied to the raid volume directly as I understand it. Can I now simply rely on this to work properly with
fstrim -v / via a cron job, just as I would if the raid wasn’t in place? Is this true even with LVM on top of the raid volume? We plan to use the hardware encryption present on the drives, so we won’t need dm-crypt here.
NOTE: I’m aware that there are several similar questions involving backporting updated kernel versions and implementing discard with the md volume — I’m asking specifically if
fstrim works against md-raid without further modification in newer kernels.
Patches for mdraid RAID 1 and 10 support for TRIM went up about a year ago.
You can test your kernel’s support by mounting the filesystem with the
discard option (which enables automatic TRIM). If it isn’t supported, you’ll see a message in syslog or
dmesg like the following:
EXT4-fs warning (device md1): ext4_issue_discard:2619: discard not supported, disabling
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.