[linux-lvm] LVM2 and Read-Only Backing Devices

John Sheu john.sheu at gmail.com
Sat Jul 19 11:25:23 UTC 2014


Summary: should LVM2 report a VG as read-only if constructed from PVs
on read-only devices?

I've got a block device (an md-raid array actually) that is, for other
reasons, being assembled as read-only right now.  There are two
relevant filesystems on it:

* an ext4 FS directly on a partition on the device
* an ext4 FS on a LVM2 VG created from a PV on another partition on the device

When I mount the ext4 FS from the raw partition, mount sees that the
device is read-only and mounts it read-only.  So far so good.

When I mount the ext4 FS from the LVM2 VG, mount sees the VG as
read-write.  Indeed, vgdisplay shows that the VG is marked as
read-write.  This causes mount to try to mount the filesystem in
read-write mode.  The first thing that this does it cause a journal
replay which fails a few writes at the kernel block layer, resulting
in some scary-looking kernel spew about lost writes before the FS is
remounted in read-only mode.

My question is: is the behavior of the VG being marked read-write in
this case expected behavior?  If not, what's the most expedient way to
fix this?  I'd like to see that a VG that includes one or more PVs
located on read-only devices be automatically marked read-only,
instead.

Thanks,
-John Sheu




More information about the linux-lvm mailing list