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

  • Linux Bash Script To List All Connected IPs and their network name
  • Cisco Switches How To Get Of Port Line Status Console Messages
  • Cisco DHCP Snooping Relay Setup Information
  • Cisco Switch Setup Guide Command List
  • Cisco 2960 Switch Reset To Factory Defaults
  • How To Boot Cisco CUCM UCSInstall 8.6, 10, 11 and 12 on KVM/Proxmox
  • VBOX VirtualBox How To Import Raw .img Disk File
  • Windows Server 2012, 2016, 2019 How To Install and Missing Disabled Telnet Client
  • proxmox vm networking breaks when you restart your network on the hostnode
  • Linux ln symlink how to update existing symbolic link
  • Ubuntu 18.04 / Linux Mint 19.1 Cannot Type or Login - solution
  • LUKS Hard Drive Encryption on Linux Mint Ubuntu Debian etc how to mount encrypted hard drive
  • How to use nmap locate other machines/computers/servers on your network using nmap
  • Linux Mint 18.2 Create Config File To Start Application Upon Login
  • Dell Wyse Thin Client BIOS Access Key
  • sudoers file in /etc warning about comments/includes!
  • Centos 7 Reallocate logical volume space to another
  • lvm how to reduce volume size
  • letsencrypt certbot error "Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80."
  • SSH error cannot Forward or Listen "bind: Cannot assign requested address"