I have some CentOS 6.x servers. They have software raid1
and fstrim
works well there.
On one of the servers, I decided to do software raid5
and ext4
. I can mount it with discard
and there is no error message.
However if I decide to run fstrim
, I get this:
[root@server ~]# fstrim / <- (raid1 works well)
[root@server ~]# fstrim /SSD <- (raid5 does not work)
fstrim: /SSD: FITRIM ioctl failed: Operation not supported
[root@server ~]# uname -a
Linux server 2.6.32-573.12.1.el6.x86_64 #1 SMP Tue Dec 15 21:19:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
The disk supports trim and there is raid1 made with same disks.
Is this because RedHat did not backported something into the kernel or I am doing something wrong?
mdraid support for discard on RAID 5 wasn't available in the 2.6 kernel series; it was added in the 3.7 kernel. I'm not aware of Red Hat backporting this functionality.
Once you get a kernel with this functionality, you may find that it is disabled, because some (older) SSDs don't actually implement TRIM properly. In this case, you need to set the kernel module option
raid456.devices_handle_discard_safely=Y
and then test thoroughly before putting the system into production.