DRBD - How to initialize primary without any secondary server available?

f3com2 picture f3com2 · Mar 31, 2016 · Viewed 17k times · Source

Here is the normal way to initialize the drbd partition:

ON BOTH SERVERS

drbdadm create-md r0
drbdadm up r0

Both servers should be now connected, check with

ONLY ON PRIMARY

drbdadm -- --overwrite-data-of-peer primary r0
cat /proc/drbd

AFTER BOTH SERVERS UP-TO-DATE - ON PRIMARY

mkfs –t ext4 –b 4096 /dev/drbd0

I now tried to prepare a primary without secondary available (e.g. customer wants a single server system and probably later wants to add a hot-standby server)

drbdadm create-md r0
drbdadm up r0
drbdadm primary r0

I got the error:

0: State change failed: (-2) Need access to UpToDate data

Is there a solution ?

Answer

Matt Kereczman picture Matt Kereczman · Apr 1, 2016

Force the node you wish to become Primary to Primary.

# drbdadm create-md r0
# drbdadm up r0
# drbdadm primary r0 --force