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