[DRBD-user] How to Trim ssd raid+ocfs2+drbd+dual primary?

Lars Ellenberg lars.ellenberg at linbit.com
Fri Jan 10 10:46:53 CET 2014

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.

On Fri, Jan 10, 2014 at 05:55:47PM +0900, trex wrote:
> On Wed, Jan 08, 2014 at 09:56:19PM +0900, trex wrote:
> >> I built HA iSCSI targets with ocfs2+dual primary.(Ubuntu 13.04)
> >> Each node has SSD raid with mdadm level0.
> >> few days later, ocfs2 became frozen sometimes.
> >> I figured out that it happens without TRIM.
> >> But, I couldn't TRIM ssd raid because ocfs2 only supports offline TRIM(fstrim) and drbd 8.4.4 only supports online TRIM(discard).
> > Uhm, to the linux block layer (including DRBD), there is no difference
> > between what you call "online" or "offline" here.  And whether you call
> > it trim or discard or unmap, again, to the linux block layer, it is all
> > the same thing.  The differences are implementation details in the low
> > level hardware drivers (scsi, fusion, etc.)
> > Did you actually try it?
> > What happened?
> > Error message?
> > Logs?
> > Are you sure your SSD *and* MD properly support and propagate the
> > discard capabilities and requests?
> First, ocfs2 doesn't have discard mount option.
> It means you have to run FSTRIM for TRIM your ssd devices.
> And it actually works.Some other filesystems are supporting automatic TRIM with discard option.(ex. btrfs, ext4 )

Still, the IO requests generated by whatever you use to do that
are the same on the linux block level.

> Second, you cannot TRIM on DRBD devices with FSTRIM.

Yes I can.

> There's a error message:"fitrim ioctl failed operation not supported"
> Without DRBD, you can run FSTRIM on any filesystem.
> So question is 'How trim filesystem on drbd which doesn't support discard mount option?'

use fstrim ;-)

Admittedly, this was not an ocfs2, I just did not have one handy.
Still, it proves that fstrim works on top of DRBD.

mount /dev/drbd0 /mnt/something
fstrim -v /mnt/something
/mnt/something: 1038696448 bytes were trimmed

So if that does not work for you, something else is wrong.

: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
please don't Cc me, but send to list   --   I'm subscribed

More information about the drbd-user mailing list