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