A couple of years ago I upgraded my netbook with a larger hard drive. I wanted to retain the contents of the old hard drive in case there was anything I still wanted off it.
So I copied the the old hard-drive into a file on the new one:
dd if=/dev/sdd5 of=~/fw-disk-image/fw-sdd5-linux-lvm-partition.raw
and I wrote/copied a script for mounting the lvms on that partition as read-only file-systems:
losetup -r /dev/loop1 ~/fw-disk-image/fw-sdd5-linux-lvm-partition.raw
pvscan
vgscan
vgchange -a y fw
cd /mnt/fw
for i in root tmp usr var home
do
mount -o ro /dev/fw/$i $i
done
Now this worked for a long time and now suddenly it fails at the vgchange -a y fw command:
# vgchange -a y fw
Error writing device /dev/loop1 at 4096 length 512.
bcache_invalidate: block (4, 0) still dirty
Failed to write mda header to /dev/loop1 fd -1
Failed to update old PV extension headers in VG fw.
Volume group "fw" not found
Cannot process volume group fw
I'm guessing that since I created a read-only loop-back device, vgchange is not happy that it can't write to it. I think that the file-system was dirty when last the disk was used but I want to ignore that.
My current system is currently running:
Linux fw 4.19.0-8-686-pae #1 SMP Debian 4.19.98-1 (2020-01-26) i686 GNU/Linux
$ vgchange --version
vgchange --version
LVM version: 2.03.02(2) (2018-12-18)
Library version: 1.02.155 (2018-12-18)
Driver version: 4.39.0
Configuration: ./configure --build=i686-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/i386-linux-gnu --libexecdir=${prefix}/lib/i386-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --exec-prefix= --bindir=/bin --libdir=/lib/i386-linux-gnu --sbindir=/sbin --with-usrlibdir=/usr/lib/i386-linux-gnu --with-optimisation=-O2 --with-cache=internal --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --with-default-pid-dir=/run --with-default-run-dir=/run/lvm --with-default-locking-dir=/run/lock/lvm --with-thin=internal --with-thin-check=/usr/sbin/thin_check --with-thin-dump=/usr/sbin/thin_dump --with-thin-repair=/usr/sbin/thin_repair --enable-applib --enable-blkid_wiping --enable-cmdlib --enable-dmeventd --enable-dbus-service --enable-lvmlockd-dlm --enable-lvmlockd-sanlock --enable-lvmpolld --enable-notify-dbus --enable-pkgconfig --enable-readline --enable-udev_rules --enable-udev_sync
Is there some way that I can (again) mount the LVs on this partition while remaining strictly read-only?