47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
commit ad720ad788be1d653da31be36fca5e886e314ddb
|
|
Author: Pavel Cahyna <pcahyna@redhat.com>
|
|
Date: Thu Aug 24 11:41:25 2023 +0200
|
|
|
|
Remove the lvmdevices file at the end of recovery
|
|
|
|
The file /etc/lvm/devices/system.devices restricts LVM to disks with
|
|
given (hardware) IDs (serial numbers, WWNs). See lvmdevices(8).
|
|
|
|
Unfortunately, when restoring to different disks than in the original
|
|
system, it will mean that LVM is broken in the recovered system (it
|
|
won't find any disks). Therefore it is safer to remove the file to
|
|
force the old behavior where LVM scans all disks. This used to be the
|
|
LVM default (use_devicesfile=0).
|
|
|
|
diff --git a/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh
|
|
new file mode 100644
|
|
index 00000000..a51e6bca
|
|
--- /dev/null
|
|
+++ b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh
|
|
@@ -0,0 +1,25 @@
|
|
+# Adapted from 260_rename_diskbyid.sh
|
|
+
|
|
+# Remove /etc/lvm/devices/system.devices
|
|
+# The file restricts LVM to disks with given (hardware) IDs (serial
|
|
+# numbers, WWNs). See lvmdevices(8).
|
|
+# Unfortunately, when restoring to different disks than in the original
|
|
+# system, it will mean that LVM is broken in the recovered system (it
|
|
+# won't find any disks). Therefore it is safer to remove the file to
|
|
+# force the old behavior where LVM scans all disks. This used to be the
|
|
+# LVM default (use_devicesfile=0).
|
|
+
|
|
+# There may be other files under /etc/lvm/devices, but they are not used
|
|
+# by default
|
|
+
|
|
+local file=/etc/lvm/devices/system.devices
|
|
+local realfile
|
|
+
|
|
+realfile="$TARGET_FS_ROOT/$file"
|
|
+# OK if file not found
|
|
+test -f "$realfile" || return 0
|
|
+mv $v "$realfile" "${realfile}.rearbak"
|
|
+LogPrint "Renamed LVM devices file $realfile to ${realfile}.rearbak
|
|
+to prevent LVM problems in the recovered system, verify that the file
|
|
+is correct after booting the recovered system and move it back, or
|
|
+regenerate it using vgimportdevices."
|