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

  • Apache PHP sending expires header solution cannot use cache with CDN
  • How to install virt-manager in Mint 22/Ubuntu 22
  • Infiniband Guide
  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer