[DRBD-user] TRIM/discard leads to secondary becoming diskless

Olav Morken olavmrk at gmail.com
Sun Oct 4 20:36:37 CEST 2015

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


I'm testing DRBD on a couple of virtual machines running Debian
Jessie, and noticed that every time a discard request is sent to the
DRBD-device, the secondary DRBD host becomes diskless:

> [  121.779367] block drbd2: discard: error=-95 s=0s
> [  121.779376] block drbd2: disk( UpToDate -> Failed )
> [  121.779382] block drbd2: Local IO failed in drbd_endio_write_sec_final. Detaching...
> [  121.779866] block drbd2: bitmap WRITE of 0 pages took 0 jiffies
> [  121.779873] block drbd2: 0 KB (0 bits) marked out-of-sync by on disk bit-map.
> [  121.779877] block drbd2: disk( Failed -> Diskless )

The backing device for the DRBD-devices is a thin-provisioned LVM2
volume, created using:

> lvcreate -L 2G -T vg/dvb-testvm-01

lvdisplay for the lvm-volume is available here:

This is a stock Debian Jessie install, using kernel version

My drbd disk configuration:

In my case, the discard happened as I was creating a file system on
the DRBD-device:

> mkfs.ext4 /dev/drbd/by-res/testvm-01

I was also able to reproduce by running blkdiscard:

> blkdiscard /dev/drbd/by-res/testvm-01

error -95 seems to be -EOPNOTSUPP, which makes sense, since I have not
made any effort in trying to support TRIM through the virtual

I assume that I am hitting this code path:

The same error seems to be dealt with when it happens on the primary:

I tried searching for this problem but couldn't find any mentions of
it. I can't be the only one running DRBD on volumes that do not
support the TRIM/discard operation, so I am wondering if anybody has
any ideas about what actually triggers this bug on my setup?

Best regards,
Olav Morken

More information about the drbd-user mailing list