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=$(basename "$VDEV_UPATH") 13 val=$(cat "/sys/block/$device/queue/rotational" 2>/dev/null) 14 if [ "$val" = "0" ]; then 15 MEDIA="ssd" 16 fi 17 18 if [ "$val" = "1" ]; then 19 MEDIA="hdd" 20 fi 21 22 vpd_pg83="/sys/block/$device/device/vpd_pg83" 23 if [ -f "$vpd_pg83" ]; then 24 if grep -q --binary "iqn." "$vpd_pg83"; then 25 MEDIA="iscsi" 26 fi 27 fi 28else 29 if [ -f "$VDEV_UPATH" ]; then 30 MEDIA="file" 31 fi 32fi 33 34echo "media=$MEDIA" 35