Sometimes udev is a bit slow finding and enumerating devices, which
causes a diskless drbd on Ubuntu when the SysV drbd script starts up the
drbd-device when the meta-device is not yet available.
Attached is a patch for the init.d script which makes the drbd-script
wait for the arrival of the ll- and md-devices.
Admittedly it's a bit of a hack because it does not check if the ll-dev
is the same as the md-dev so worst case it could delay boot twice the
amount it should but at least it shouldn't slow the booting down when
the devices are up.
hope it's useful for someone,
Maarten.
--- drbd 2011-07-06 00:39:47.875154357 +0200
+++ /etc/init.d/drbd 2011-07-06 00:09:34.162348046 +0200
@@ -26,7 +26,7 @@
PROC_DRBD="/proc/drbd"
MODPROBE="/sbin/modprobe"
RMMOD="/sbin/rmmod"
-UDEV_TIMEOUT=10
+UDEV_TIMEOUT=20
ADD_MOD_PARAM=""
if [ -f $DEFAULTFILE ]; then
@@ -156,6 +156,27 @@
$DRBDADM sh-nop
log_daemon_msg "Starting DRBD resources"
assure_module_is_loaded
+
+ # make sure udev has time to create the device files for the ll and
md-device
+ for RESOURCE in `$DRBDADM sh-resources`; do
+ for DEVICE in `$DRBDADM sh-ll-dev $RESOURCE`; do
+ UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
+ while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
+ sleep 1
+ UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
+ done
+ done
+ for DEVICE in `$DRBDADM sh-md-dev $RESOURCE`; do
+ UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
+ while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
+ sleep 1
+ UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
+ done
+ done
+ done
+
+ [ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
+
adjust_with_progress
# make sure udev has time to create the device files
@@ -164,7 +185,7 @@
UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
sleep 1
- UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
+ UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
done
done
done
_______________________________________________
drbd-user mailing list
[email protected]
http://lists.linbit.com/mailman/listinfo/drbd-user