I'm running drbd83 with ocfs2 in centos 5 and planning to use packemaker with them.
Afer some time, I'm facing drbd split brain problem.
version: 8.3.13 (api:88/proto:86-96)
GIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by mockbuild@builder10.centos.org, 2012-05-07 11:56:36
1: cs:StandAlone ro:Primary/Unknown ds:UpToDate/DUnknown r-----
ns:0 nr:0 dw:112281991 dr:797551 al:99 bm:6401 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:60
I can't switch my drbd to secondary.
drbdadm secondary r0
1: State change failed: (-12) Device is held open by someone
Command 'drbdsetup 1 secondary' terminated with exit code 11
My drbd resource config:
resource r0 {
syncer {
rate 1000M;
verify-alg sha1;
}
disk {
on-io-error detach;
}
handlers {
pri-lost-after-sb "/usr/lib/drbd/notify-split-brain.sh root";
}
net {
allow-two-primaries;
after-sb-0pri discard-younger-primary;
after-sb-1pri call-pri-lost-after-sb;
after-sb-2pri call-pri-lost-after-sb;
}
startup { become-primary-on both; }
on serving_4130{
device /dev/drbd1;
disk /dev/sdb1;
address 192.168.4.130:7789;
meta-disk internal;
}
on MT305-3182 {
device /dev/drbd1;
disk /dev/xvdb1;
address 192.168.3.182:7789;
meta-disk internal;
}
}
Status of ocfs2 status:
service ocfs2 status
Configured OCFS2 mountpoints: /data
lsof show that, there is one process relative with drbd.
lsof | grep drbd
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
drbd1_wor 7782 root cwd DIR 253,0 4096 2 /
drbd1_wor 7782 root rtd DIR 253,0 4096 2 /
drbd1_wor 7782 root txt unknown /proc/7782/exe
And it's a dead symlink:
# ls -l /proc/7782/exe
ls: cannot read symbolic link /proc/7782/exe: No such file or directory
lrwxrwxrwx 1 root root 0 May 4 09:56 /proc/7782/exe
# ps -ef | awk '$2 == "7782" { print $0 }'
root 7782 1 0 Apr22 ? 00:00:20 [drbd1_worker]
Notice that this process is wrapped in square brackets:
args COMMAND command with all its arguments as a string. Modifications to the arguments may be shown. The
output in this column may contain spaces. A process marked <defunct> is partly dead, waiting to
be fully destroyed by its parent. Sometimes the process args will be unavailable; when this
happens, ps will instead print the executable name in brackets.
So, the final question is: how can we manually recover DRBD in this case without rebooting?
Reply to @andreask:
My partition table:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
35G 6.9G 27G 21% /
/dev/xvda1 99M 20M 74M 22% /boot
tmpfs 1.0G 0 1.0G 0% /dev/shm
/dev/drbd1 100G 902M 100G 1% /data
The device names:
# dmsetup ls --tree -o inverted
(202:2)
├─VolGroup00-LogVol01 (253:1)
└─VolGroup00-LogVol00 (253:0)
Pay attention to the block device (253:0), it is the same as from the output of lsof:
# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID vCd152-amVZ-GaPo-H9Zs-TIS0-KI6j-ej8kYi
LV Write Access read/write
LV Status available
# open 1
LV Size 35.97 GB
Current LE 1151
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Reply to @Doug:
# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 39.88 GB
PE Size 32.00 MB
Total PE 1276
Alloc PE / Size 1276 / 39.88 GB
Free PE / Size 0 / 0
VG UUID OTwzII-AP5H-nIbH-k2UA-H9nw-juBv-wcvmBq
UPDATE Fri May 17 16:08:16 ICT 2013
Here are some ideas from Lars Ellenberg:
if the filesystem is still mounted ... oh well. unmount it. not lazy, but really.
I'm sure, OCFS2 was already unmounted.
If nfs was involved, try
killall -9 nfsd killall -9 lockd echo 0 > /proc/fs/nfsd/threads
No, NFS was not involved.
if lvm/dmsetup/kpartx/multipath/udev is involved, try
dmsetup ls --tree -o invertedand check if there are dependencies from drbd.
As you can see from my above output, LVM doesn't related to DRBD:
pvdisplay -m
--- Physical volume ---
PV Name /dev/xvda2
VG Name VolGroup00
PV Size 39.90 GB / not usable 20.79 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 1276
Free PE 0
Allocated PE 1276
PV UUID 1t4hkB-p43c-ABex-stfQ-XaRt-9H4i-51gSTD
--- Physical Segments ---
Physical extent 0 to 1148:
Logical volume /dev/VolGroup00/LogVol00
Logical extents 0 to 1148
Physical extent 1149 to 1275:
Logical volume /dev/VolGroup00/LogVol01
Logical extents 0 to 126
fdisk -l
Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 5221 41833260 8e Linux LVM
Disk /dev/xvdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdb1 1 13054 104856223+ 83 Linux
if loop/cryptoloop/etc is involved, check if one of those is still accessing them.
if some virtualization tecknique is in use, shut down/destroy all containers/VMs that may have been accessing that drbd during their life time.
No, it doesn't.
Sometimes it is just udev or equivalent doing a race.
I have disabled the multipath rule and even stop the udevd, and nothing change.
Sometimes it is a unix domain socket or similar still held open (won't necessary show up in lsof/fuser).
If so, how can we find out this unix socket?
umountocfsbefore trying to demote it to secondary? – Nils Aug 3 '12 at 21:03