after drbd down , is it safe to mount underlying device

Dingwall, James James.Dingwall at ncrvoyix.com
Tue Apr 16 09:15:43 CEST 2024


> Small question regarding the underlying disk
> 
> If on the primary, and I started drbd on a disk with existing data,
> 
> some time later I unmount and I down drbd....
> 
> Can I directly mount the disk again without risk of corruption? or once drbd always drbd?

This is safe so long as you don't write (if you intend to reform the DRBD resource) but beware even mounting some filesystems with `-o ro` can still result in writes.  You can add a generic step to prevent this by creating a loop device from the block device:

# losetup -Pfvr --show /dev/....

# ls /dev/loop1*
/dev/loop1  /dev/loop1p1  /dev/loop1p2

# mount /dev/loop1p2 /tmp/x
Error opening '/dev/loop1p2' read-write
Could not mount read-write, trying read-only

(That happened to be an NTFS formatted partition from a virtual machine)

If you do write to the disk and bypass drbd then you'll need to invalidate the secondary and resync.

James



More information about the drbd-user mailing list