|
|
f25f8e |
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
|
|
|
f25f8e |
index aa6fc938..4bc59131 100644
|
|
|
f25f8e |
--- a/usr/share/rear/lib/layout-functions.sh
|
|
|
f25f8e |
+++ b/usr/share/rear/lib/layout-functions.sh
|
|
|
f25f8e |
@@ -476,6 +476,9 @@ get_sysfs_name() {
|
|
|
f25f8e |
### /dev/dm-3 -> /dev/mapper/system-tmp
|
|
|
f25f8e |
### /dev/dm-4 -> /dev/mapper/oralun
|
|
|
f25f8e |
### /dev/dm-5 -> /dev/mapper/oralunp1
|
|
|
f25f8e |
+### /dev/sda -> /dev/sda
|
|
|
f25f8e |
+###
|
|
|
f25f8e |
+### Returns 0 on success, 1 if device is not existing
|
|
|
f25f8e |
get_device_name() {
|
|
|
f25f8e |
### strip common prefixes
|
|
|
f25f8e |
local name=${1#/dev/}
|
|
|
f25f8e |
@@ -483,47 +486,39 @@ get_device_name() {
|
|
|
f25f8e |
|
|
|
f25f8e |
contains_visible_char "$name" || BugError "Empty string passed to get_device_name"
|
|
|
f25f8e |
|
|
|
f25f8e |
- ### Translate dm-8 -> mapper/test
|
|
|
f25f8e |
- local device dev_number mapper_number
|
|
|
f25f8e |
- if [[ -d /sys/block/$name ]] ; then
|
|
|
f25f8e |
+ if [[ "$name" =~ ^mapper/ ]]; then
|
|
|
f25f8e |
+ echo "/dev/$name"
|
|
|
f25f8e |
+ return 0
|
|
|
f25f8e |
+ fi
|
|
|
f25f8e |
+
|
|
|
f25f8e |
+ if [[ -L "/dev/$name" ]] ; then
|
|
|
f25f8e |
+ # Map vg/lv into dm-X, which will then be resolved later
|
|
|
f25f8e |
+ name="$( basename $(readlink -f /dev/$name) )"
|
|
|
f25f8e |
+ fi
|
|
|
f25f8e |
+
|
|
|
f25f8e |
+ if [[ "$name" =~ ^dm- ]] ; then
|
|
|
f25f8e |
+ local device
|
|
|
f25f8e |
if [[ -r /sys/block/$name/dm/name ]] ; then
|
|
|
f25f8e |
### recent kernels have a dm subfolder
|
|
|
f25f8e |
- echo "/dev/mapper/$( < /sys/block/$name/dm/name)";
|
|
|
f25f8e |
- return 0
|
|
|
f25f8e |
+ device="$( < /sys/block/$name/dm/name )"
|
|
|
f25f8e |
else
|
|
|
f25f8e |
- ### loop over all block devices
|
|
|
f25f8e |
- dev_number=$( < /sys/block/$name/dev)
|
|
|
f25f8e |
- for device in /dev/mapper/* ; do
|
|
|
f25f8e |
- mapper_number=$(dmsetup info -c --noheadings -o major,minor ${device#/dev/mapper/} 2>/dev/null )
|
|
|
f25f8e |
- if [ "$dev_number" = "$mapper_number" ] ; then
|
|
|
f25f8e |
- echo "$device"
|
|
|
f25f8e |
- return 0
|
|
|
f25f8e |
- fi
|
|
|
f25f8e |
- done
|
|
|
f25f8e |
+ local dev_number=$( < /sys/block/$name/dev)
|
|
|
f25f8e |
+ if [[ ! -r "$TMP_DIR/dmsetup_info.txt" ]] ; then
|
|
|
f25f8e |
+ dmsetup info --noheadings -c -o name,major,minor > "$TMP_DIR/dmsetup_info.txt"
|
|
|
f25f8e |
+ fi
|
|
|
f25f8e |
+ device="$( awk -F ':' "/$dev_number\$/ { print \$1 }" < "$TMP_DIR/dmsetup_info.txt" )"
|
|
|
f25f8e |
+ [[ -n "$device" ]] || BugError "No device returned for major/minor $dev_number"
|
|
|
f25f8e |
fi
|
|
|
f25f8e |
- fi
|
|
|
f25f8e |
-
|
|
|
f25f8e |
- ### Translate device name to mapper name. ex: vg/lv -> mapper/vg-lv
|
|
|
f25f8e |
- if [[ "$name" =~ ^mapper/ ]]; then
|
|
|
f25f8e |
- echo "/dev/$name"
|
|
|
f25f8e |
+ echo "/dev/mapper/$device"
|
|
|
f25f8e |
return 0
|
|
|
f25f8e |
fi
|
|
|
f25f8e |
- if my_dm=`readlink /dev/$name`; then
|
|
|
f25f8e |
- for mapper_dev in /dev/mapper/*; do
|
|
|
f25f8e |
- if mapper_dm=`readlink $mapper_dev`; then
|
|
|
f25f8e |
- if [ "$my_dm" = "$mapper_dm" ]; then
|
|
|
f25f8e |
- echo $mapper_dev
|
|
|
f25f8e |
- return 0
|
|
|
f25f8e |
- fi
|
|
|
f25f8e |
- fi
|
|
|
f25f8e |
- done
|
|
|
f25f8e |
- fi
|
|
|
f25f8e |
|
|
|
f25f8e |
### handle cciss sysfs naming
|
|
|
f25f8e |
name=${name//!//}
|
|
|
f25f8e |
|
|
|
f25f8e |
### just return the possibly nonexisting name
|
|
|
f25f8e |
echo "/dev/$name"
|
|
|
f25f8e |
+ [[ -r "/dev/$name" ]] && return 0
|
|
|
f25f8e |
return 1
|
|
|
f25f8e |
}
|
|
|
f25f8e |
|
|
|
f25f8e |
diff --git a/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh b/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh
|
|
|
f25f8e |
index 0de4f60b..64276dfe 100644
|
|
|
f25f8e |
--- a/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh
|
|
|
f25f8e |
+++ b/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh
|
|
|
f25f8e |
@@ -1,3 +1,6 @@
|
|
|
f25f8e |
+# don't collect this anymore, this can be very slow
|
|
|
f25f8e |
+return 0
|
|
|
f25f8e |
+
|
|
|
f25f8e |
# collect output from production SAN disks
|
|
|
f25f8e |
|
|
|
f25f8e |
find /sys/class/fc_transport -follow -maxdepth 6 \( -name model -o -name vendor -o -name rev -name state -o -name model_name -o -name size -o -name node_name \) 2>/dev/null| egrep -v 'driver|rport|power|drivers|devices' | xargs grep '.' > $VAR_DIR/recovery/fc_transport.info >&2
|