Re: after drbd down , is it safe to mount underlying device

"Dingwall, James" <James.Dingwall-pmimH2v9lN1Wk0Htik3J/[email protected]> Tue, 16 Apr 2024 07:15:43 +0000
Newsgroups gmane.comp.linux.drbd
Message-ID <BY3PR15MB5044C41F701F5546AB4BF8BAF7082@BY3PR15MB5044.namprd15.prod.outlook.com>
> Small question regarding the underlying disk=0A=
> =0A=
> If on the primary, and I started drbd on a disk with existing data,=0A=
> =0A=
> some time later I unmount and I down drbd....=0A=
> =0A=
> Can I directly mount the disk again without risk of corruption? or once d=
rbd always drbd?=0A=
=0A=
This is safe so long as you don't write (if you intend to reform the DRBD r=
esource) but beware even mounting some filesystems with `-o ro` can still r=
esult in writes.  You can add a generic step to prevent this by creating a =
loop device from the block device:=0A=
=0A=
# losetup -Pfvr --show /dev/....=0A=
=0A=
# ls /dev/loop1*=0A=
/dev/loop1  /dev/loop1p1  /dev/loop1p2=0A=
=0A=
# mount /dev/loop1p2 /tmp/x=0A=
Error opening '/dev/loop1p2' read-write=0A=
Could not mount read-write, trying read-only=0A=
=0A=
(That happened to be an NTFS formatted partition from a virtual machine)=0A=
=0A=
If you do write to the disk and bypass drbd then you'll need to invalidate =
the secondary and resync.=0A=
=0A=
James=0A=
=0A=