[DRBD-user] yes you can mount the secondary read-only (bug reports)

Dave Dykstra dwdha at drdykstra.us
Tue Jan 4 15:55:27 CET 2005

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


The FAQ says that DRBD does not allow mounting the secondary, but I found
a way to do it.  If I start up DRBD on two nodes, make one primary but
not mount it there, then attempt to mount the secondary side it gets
mounted read-only.  Then I can mount the primary read-write.  This may
be considered a feature by some but I consider it a bug.  I accidentally
got into this situation by a misunderstanding of the parameter to the
heartbeat 'drbddisk' script when I configured heartbeat for the first
time and passed 'drbd0' to the script as an example showed rather than the
name I had chosen for my resource.  As a result, the primary & secondary
sides didn't get swapped, but heartbeat unmounted the primary side and
mounted the secondary.

Secondary bug report: it took me a long time to figure out because I
saw no error messages anywhere from drbddisk; the only effect was that
the filesystem was mounted read-only.  It turns out that there were no
error messages because the error codes from "$DRBDADM primary $RES" and
"$DRBDADM secondary $RES" in /etc/ha.d/resource.d/drbddisk are ignored.
If I put a "set -e" before each of those two commands, heartbeat notices
the error code and refuses to do the switch when I request a voluntary
hb_standby failover.  I report this to the drbd mailing list because at
least on Debian the drbddisk script is part of one of the drbd packages,
not the heartbeat package.

Here's more details in case it matters.  The two machines are newly purchased
running a recent Debian testing with packages drbd0.7-module-source &
drbd0.7-utils version 0.7.5-2 and a custom kernel based on 2.4.26.  On
the system that has the secondary side mounted read-only, there get to
be 18 copies of the following errors in dmesg when the mount goes through:
    drbd0: ASSERT( mdev->state == Primary ) in drbd_req.c:186
    drbd0: ASSERT( mdev->state == Primary ) in drbd_compat_wrappers.h:286
Here's my drbd.conf:
    resource home {
	protocol B;
	syncer { rate 50M; }
	on swfs1 {
	    device  /dev/drbd0;
	    disk    /dev/hda8;
	    address 192.168.1.1:7791;
	    meta-disk internal;
	}
	on swfs2 {
	    device  /dev/drbd0;
	    disk    /dev/hdb8;
	    address 192.168.1.2:7791;
	    meta-disk internal;
	}
    }

- Dave Dykstra



More information about the drbd-user mailing list