When working with virtualized environments that support dynamic disk extension, using raw block devices for DRBD makes practical sense. The traditional approach with partitions or LVM adds unnecessary complexity when you need to resize storage later. Here's what happens when you try to configure DRBD directly on /dev/sdb
:
# drbdadm attach data
1: Failure: (127) Device minor not allocated
additional info from kernel:
unknown minor
Command 'drbdsetup-84 attach 1 /dev/sdb /dev/sdb internal' terminated with exit code 10
The error occurs because DRBD needs proper device minor number allocation before attaching to raw storage. Unlike partitioned disks where minor numbers are automatically assigned, raw devices require explicit handling.
Here's how to properly configure DRBD on a raw block device:
# Step 1: Load DRBD module with sufficient minor numbers
modprobe drbd minor_count=32
# Step 2: Verify major/minor assignment
ls -l /dev/drbd*
# Step 3: Create device node manually if needed
mknod /dev/drbd1 b 147 1
chmod 600 /dev/drbd1
# Step 4: Initialize metadata (as you've already done)
drbdadm create-md data
# Step 5: Bring up the resource with adjusted command
drbdadm up data
# Step 6: Verify status
drbdadm status data
Your resource configuration file (/etc/drbd.d/data.res
) should include these critical parameters:
resource data {
protocol C;
handlers {
pri-on-incon-degr "echo DRBD degraded! | wall; /usr/lib/drbd/notify-pri-on-incon-degr.sh;";
}
startup {
wfc-timeout 30;
}
disk {
resync-rate 100M;
on-io-error detach;
}
net {
cram-hmac-alg "sha1";
shared-secret "your-secret-here";
after-sb-0pri discard-zero-changes;
after-sb-1pri consensus;
after-sb-2pri disconnect;
}
device /dev/drbd1;
meta-disk internal;
disk /dev/sdb;
on node1 {
address 10.10.10.16:7789;
node-id 0;
}
on node2 {
address 10.10.10.17:7789;
node-id 1;
}
}
If you still encounter issues:
- Check kernel messages:
dmesg | grep drbd
- Verify DRBD module parameters:
cat /sys/module/drbd/parameters/minor_count
- Ensure proper permissions:
ls -l /dev/sdb /dev/drbd1
- Review DRBD logs:
journalctl -u drbd
When using raw devices, remember these performance optimizations:
# Set proper IO scheduler (for SSD/NVMe)
echo none > /sys/block/sdb/queue/scheduler
# Adjust DRBD sync rate based on your network
drbdsetup /dev/drbd1 syncer -r 100M
# Monitor performance with:
drbdadm status data
cat /proc/drbd
When working with virtualized environments where disk expansion happens frequently, using raw disk devices (/dev/sdb
) with DRBD offers significant advantages over traditional partitioned or LVM-backed storage:
- No partition table overhead
- Immediate access to full disk capacity
- Simpler expansion path when hypervisor extends disk
- Eliminates LVM management complexity
The key error message indicates DRBD isn't properly initialized:
1: Failure: (127) Device minor not allocated
additional info from kernel:
unknown minor
This typically occurs when the DRBD kernel module hasn't properly registered the device minor number.
Here's the correct sequence to make raw disk DRBD work:
# Initialize metadata
drbdadm create-md data
# Bring up the resource (creates device minor)
drbdadm up data
# Now attach the disk
drbdadm attach data
# Verify connection
drbdadm connect data
Your resource configuration is correct, but pay attention to these critical aspects:
resource data {
device /dev/drbd1;
meta-disk internal;
disk /dev/sdb;
...
}
Key points:
meta-disk internal
stores metadata on the same raw device- No partition requirement for
/dev/sdb
- Device minor allocation happens during
up
phase
If you still encounter issues:
# Check kernel module status
cat /proc/drbd
# Verify device availability
ls -l /dev/drbd*
# Check system logs
journalctl -xe
# Alternative setup command
drbdsetup-84 new-resource data 1
drbdsetup-84 new-minor data 1
When your hypervisor expands the virtual disk:
- Expand the disk on hypervisor side
- On both nodes:
drbdadm resize data
- Resize filesystem:
resize2fs /dev/drbd1
This simple process demonstrates why raw disk approach shines for expandable storage.