summaryrefslogtreecommitdiffstats
path: root/scripts/collect-sysfs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/collect-sysfs.sh')
-rwxr-xr-xscripts/collect-sysfs.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/collect-sysfs.sh b/scripts/collect-sysfs.sh
new file mode 100755
index 0000000..b7ce017
--- /dev/null
+++ b/scripts/collect-sysfs.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+filename=nvme-sysfs-$(hostname)-$(uname -r).tar.xz
+
+declare -a dirs=(
+ "/sys/class/nvme"
+ "/sys/class/nvme-fabrics"
+ "/sys/class/nvme-generic"
+ "/sys/class/nvme-subsystem"
+ "/sys/bus/pci/slots"
+)
+
+files=""
+for d in "${dirs[@]}"; do
+ files+="${d} "
+ for l in "${d}"/*; do
+ files+="$(readlink -f $l) "
+ done
+done
+
+tar -c -J -p -f "${filename}" ${files} 2> /dev/null