mkfs.ext3: Wrong medium type while trying to determine filesystem size

Problem:

While going through a DRBD howto a coworker made, I came across the following problem. On a freshly created DRBD block device, mkfs bails out with the following message:

[root@lancre ~]# mkfs.ext3 /dev/drbd0
mke2fs 1.39 (29-May-2006)
mkfs.ext3: Wrong medium type while trying to determine filesystem size

Cause:

The DRBD block device you’re trying to access is configured to act as a Secondary device, which means it cannot be accessed to be read ot to be written to.
The state of your device is kept in /proc/drbd:

[root@lancre ~]# cat /proc/drbd
version: 8.3.2 (api:88/proto:86-90)
GIT-hash: dd7985327f146f33b86d4bff5ca8c94234ce840e build by mockbuild@v20z-x86-64.home.local, 2009-08-29 14:07:55
 0: cs:SyncSource ro:Secondary/Secondary ds:UpToDate/Inconsistent B r----
 ns:10159548 nr:0 dw:0 dr:10167296 al:0 bm:620 lo:11 pe:5 ua:253 ap:0 ep:1 wo:b oos:202535316
 [>....................] sync'ed:  4.8% (197788/207708)M
 finish: 0:57:20 speed: 58,832 (54,620) K/sec

The part ro:Secondary/Secondary tells you what both nodes are set to.

Another way to check the state of the block device is with the drbdadm command:

[root@lancre ~]# drbdadm state drbd0
Secondary/Secondary

Solution:

Switch the DRBD block device to Primary using drbdadm:

[root@lancre ~]# drbdadm primary drbd0

This shouldn’t generate any output if it doesn’t encounter any errors.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>