When working with DRBD (Distributed Replicated Block Device) on LVM, resizing the underlying disk requires careful handling. The error message you encountered:
resize2fs: Device or resource busy while trying to open /dev/VolGroup00/LogVol02
Couldn't find valid filesystem superblock.
indicates that the filesystem is currently in use by DRBD, preventing direct resizing.
Before proceeding, ensure:
- DRBD is properly configured on both nodes
- You have root access to both servers
- The LVM volume has already been extended (as you've done by adding 4GB)
- You have a recent backup of your data
1. Stop DRBD on Both Nodes
First, bring the resource down on both nodes:
drbdadm down mysql
service drbd stop
2. Resize the Physical Volume
Since you've already extended the LVM volume, we need to inform DRBD about the new size:
drbdadm resize mysql
3. Bring DRBD Back Online
Start DRBD on both nodes:
service drbd start
drbdadm up mysql
4. Resize the Filesystem
Now you can resize the filesystem while it's mounted:
resize2fs /dev/drbd0
Or if you're using XFS:
xfs_growfs /mount/point
After completing the resize, verify everything worked:
drbdadm status mysql
df -h
lvdisplay
If you encounter synchronization issues after resizing:
drbdadm -- --overwrite-data-of-peer primary mysql
Then verify the sync status:
cat /proc/drbd
For frequent resizing, consider creating a script like this:
#!/bin/bash
# DRBD resize script
RESOURCE="mysql"
SIZE="+4G"
lvresize -L $SIZE /dev/VolGroup00/LogVol02
drbdadm down $RESOURCE
drbdadm up $RESOURCE
drbdadm resize $RESOURCE
resize2fs /dev/drbd0
When working with DRBD (Distributed Replicated Block Device) on top of LVM, attempting to resize the underlying logical volume while DRBD is actively using it will result in the "Device or resource busy" error. This occurs because:
- The device is actively mounted or in use by DRBD
- Filesystem operations cannot be performed on a live block device
- The DRBD layer sits between the physical storage and filesystem
Before proceeding with the resize operation, ensure:
1. DRBD is properly configured on both nodes (as shown in your config)
2. LVM extensions were already performed on both nodes
3. You have root access to both primary and secondary nodes
4. Your DRBD resource is in 'Connected' and 'UpToDate' state
Here's the complete workflow to safely expand your DRBD storage:
1. Temporarily Disable DRBD Synchronization
# On primary node:
drbdadm adjust mysql
drbdadm pause-sync mysql
2. Resize the DRBD Meta-Data Area
# On both nodes:
drbdadm resize mysql --assume-clean
3. Resize the Underlying LVM (if not already done)
# Example for LVM extension (already done in your case):
# lvextend -L +4G /dev/VolGroup00/LogVol02
4. Resize the DRBD Device Itself
# On primary node:
drbdadm resize mysql
5. Resume Synchronization
drbdadm resume-sync mysql
6. Verify the New Size
drbdadm status mysql
cat /proc/drbd
7. Finally Resize the Filesystem
# For ext4 (primary node only):
resize2fs /dev/drbd0
# For xfs (primary node only):
xfs_growfs /mount/point
Scenario: "Couldn't find valid filesystem superblock" error
Solution: You're trying to resize the LVM device directly instead of the DRBD device. Always operate on /dev/drbdX for filesystem operations.
Scenario: DRBD reports "size mismatch" after resize
Solution: Ensure both nodes have identical underlying storage sizes before DRBD resize operation.
For frequent resizing operations, consider this bash script:
#!/bin/bash
RESOURCE="mysql"
NEW_SIZE="54G"
# Primary node operations
lvextend -L $NEW_SIZE /dev/VolGroup00/LogVol02
drbdadm adjust $RESOURCE
drbdadm pause-sync $RESOURCE
drbdadm resize $RESOURCE --assume-clean
drbdadm resize $RESOURCE
drbdadm resume-sync $RESOURCE
resize2fs /dev/drbd0
# Secondary node operations (via SSH)
ssh root@secondary-node "lvextend -L $NEW_SIZE /dev/VolGroup01/LogVol02"
ssh root@secondary-node "drbdadm adjust $RESOURCE"
After completion, verify all components:
# Check LVM size
lvdisplay /dev/VolGroup00/LogVol02 | grep "Size"
# Check DRBD size
drbdadm dstate mysql
# Check filesystem size
df -h /mount/point