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 ?
Force the node you wish to become Primary to Primary.
# drbdadm create-md r0
# drbdadm up r0
# drbdadm primary r0 --force