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
 


Tags:

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

  • VMWare Pro Workstation Nic Disconnected and No IP Using NAT
  • Linux How To Create A RamDisk
  • mdadm force resync when resync=PENDING solution
  • Proxmox Breaks Storage/LVM Backing If Killing QEMU-IMG
  • Proxmox trying to acquire lock... TASK ERROR: can't lock file '/var/lock/qemu-server/lock-102.conf' - got timeout
  • Debian 9 SSH root password authentication failure password not working problem / solution
  • QEMU / KVM How To Manually Create Basic Virtual Machine VM
  • Linux wlan0 check all wireless clients
  • PHP Issues With Decoding Strange Smart Quotes And Non-Standard ASCII Characters
  • /etc/iproute2/rt_tables default settings file in Linux Centos 6,7 and most other NIX's
  • bind named error solutions named[2169]: error (no valid DS) resolving / error (broken trust chain) resolving / : error (no valid RRSIG) resolving 'com/DS/IN':
  • iptables how to log ALL dropped incoming packets
  • How To Edit Linux Based NM Network Manager Connection Settings Without GUI
  • Linux Disable IPV6 Centos / Debian / Mint Howto
  • Linux use growisofs to burn a larger file on a BD-R / Bluray Disc
  • Linux partprobe/partx cannot access last and 4th partition
  • DRBD Errors Caused By Physical Corruption
  • mdadm: add new device failed for /dev/sdb4 as 3: Invalid argument solution
  • Linux named / bind how to dump, view and clear the cache!
  • Centos 6 / 7 / 8 How To Change Default nameservers in /etc/resolv.conf when using DHCP / dhclient