drbd won't create device if previous partition is on it Command 'drbdmeta 0 v08 /dev/md160 internal create-md' terminated with exit code 40

This is what fixed it:

[root@box13 ~]# dd if=/dev/zero of=/dev/md160 bs=512 count=500

Basically you need to wipe out more than just the 512 byte partition table so 512 bytes * 500 is more than enough to make DRBD happy and think the partition is now empty.

The reason this happens is because it gets confused when there is a previous partition with data on the device you are using.


root@box13 ~]# dd if=/dev/zero of=/dev/md160 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.241883 s, 2.1 kB/s
[root@box13 ~]# drbdadm create-md r0
DRBD module version: 8.3.13
   userland version: 8.3.16
preferably kernel and userland versions should match.
md_offset 1395733229568
al_offset 1395733196800
bm_offset 1395690598400

Found ext3 filesystem
  1363020736 kB data area apparently used
  1362979100 kB left usable by current configuration

Device size would be truncated, which
would corrupt data and result in
'access beyond end of device' errors.
You need to either
   * use external meta data (recommended)
   * shrink that filesystem first
   * zero out the device (destroy the filesystem)
Operation refused.

Command 'drbdmeta 0 v08 /dev/md160 internal create-md' terminated with exit code 40
drbdadm create-md r0: exited with code 40
[root@box13 ~]# mount^C
[root@box13 ~]# ^C
[root@box13 ~]# mount
/dev/md0 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
[root@box13 ~]# dd if=/dev/zero of=/dev/md160 bs=512 count=500


drbd, previous, partition, drbdmeta, dev, md, terminated, dd, bs, byte, bytes, copied, kb, drbdadm, module, userland, preferably, kernel, versions, md_offset, al_offset, bm_offset, ext, filesystem, usable, configuration, truncated, corrupt, errors, external, meta, recommended, exited, mount, rw, proc, sysfs, sys, devpts, pts, gid, mode, tmpfs, shm, fs, binfmt_misc, sunrpc, var, lib, nfs, rpc_pipefs,

Latest Articles

  • Centos 7 how to save iptables rules like Centos 6
  • nfs tuning maximum amount of connections
  • qemu-kvm error "Could not initialize SDL(No available video device) - exiting"
  • Centos 7 tftpd will not work with selinux enabled
  • Debian Ubuntu Mint Howto Create Bridge (br0)
  • How To Control Interface that dhcpd server listens to on Debian based Linux like Mint and Ubuntu
  • LUKS unable to type password to unlock during boot on Debian, Ubuntu and Mint
  • Debian Ubuntu and Linux Mint Broken Kernel After Date - New Extra Module Naming Convention
  • Wordpress overwrites and wipes out custom htaccess rules and changes soluton
  • Apache htaccess and mod_rewrite how to redirect and force all URLs and visitors to the SSL / HTTPS version
  • python 3 pip cannot install mysql module
  • QEMU-KVM won't boot Windows 2016 or 2019 server on an Intel Core i3
  • Virtualbox vbox not starting
  • Bind / named not responding to queries solution
  • Linux Mint How To Set Desktop Background Image From Bash Prompt CLI
  • ImageMagick Convert PDF Not Authorized
  • ImageMagick Converted PDF to JPEG some files have a black background solution
  • Linux Mint Mate Customize the Lock screen messages and hide username and real name
  • Ubuntu/Gnome/Mint/Centos How To Take a partial screenshot
  • ssh how to verify your host key / avoid MIM attacks