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

  • 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
  • Cisco IP Phone CP-8845 8800/8900 Series How To Reset To Factory Settings Instructions
  • ls how to list ONLY directories
  • How to encrypt your SSH private key file id_rsa
  • Linux Mint 18 Disable User Name List from showing on Login Screen
  • Firefox Cannot Hit Enter Key In Address Bar and Location History Not Working
  • Cisco Unified Communications Manager / CUCM IP 8.6,10,12 Install Error Solution
  • Ubuntu Debian Mint Linux SSHD OpenSSH Server Not Starting After Reboot Solution
  • nmap how to scan for all ports and not just the 1000 most common ports
  • Windows 7,8,10 and Server 2008, 2012, 2016, 2019 Read Only Attribute Won't Go Away
  • bind / named how to make a wildcard record and retain defined A records
  • Cisco Unified Communications Manager 12 Install Errors on Proxmox/KVM
  • Local Vs Universally Administered MAC Address NIC Refuses to come up
  • Cisco Unified Communications Manager 12 CUCM 12 - How To Enable Video Calling
  • Windows 7, 8, 10, Windows Server 2008, 2012, 2016, 2019 How To AC97 Audio Drivers and Other Unsigned Drivers
  • Cisco Unified Communications Manager / CUCM IP Telephony Definitions