1#!/bin/sh 2# 3# Print out the type of device 4# 5 6if [ "$1" = "-h" ] ; then 7 echo "Show whether a vdev is a file, hdd, ssd, or iscsi." 8 exit 9fi 10 11if [ -b "$VDEV_UPATH" ]; then 12 device="${VDEV_UPATH##*/}" 13 read -r val 2>/dev/null < "/sys/block/$device/queue/rotational" 14 case "$val" in 15 0) MEDIA="ssd" ;; 16 1) MEDIA="hdd" ;; 17 esac 18 19 vpd_pg83="/sys/block/$device/device/vpd_pg83" 20 if [ -f "$vpd_pg83" ]; then 21 if grep -q --binary "iqn." "$vpd_pg83"; then 22 MEDIA="iscsi" 23 fi 24 fi 25else 26 if [ -f "$VDEV_UPATH" ]; then 27 MEDIA="file" 28 fi 29fi 30 31echo "media=$MEDIA" 32