1*eda14cbcSMatt Macy#!/bin/sh 2*eda14cbcSMatt Macy# 3*eda14cbcSMatt Macy# Print out the type of device 4*eda14cbcSMatt Macy# 5*eda14cbcSMatt Macy 6*eda14cbcSMatt Macyif [ "$1" = "-h" ] ; then 7*eda14cbcSMatt Macy echo "Show whether a vdev is a file, hdd, or ssd." 8*eda14cbcSMatt Macy exit 9*eda14cbcSMatt Macyfi 10*eda14cbcSMatt Macy 11*eda14cbcSMatt Macyif [ -b "$VDEV_UPATH" ]; then 12*eda14cbcSMatt Macy device=$(basename "$VDEV_UPATH") 13*eda14cbcSMatt Macy val=$(cat "/sys/block/$device/queue/rotational" 2>/dev/null) 14*eda14cbcSMatt Macy if [ "$val" = "0" ]; then 15*eda14cbcSMatt Macy MEDIA="ssd" 16*eda14cbcSMatt Macy fi 17*eda14cbcSMatt Macy 18*eda14cbcSMatt Macy if [ "$val" = "1" ]; then 19*eda14cbcSMatt Macy MEDIA="hdd" 20*eda14cbcSMatt Macy fi 21*eda14cbcSMatt Macyelse 22*eda14cbcSMatt Macy if [ -f "$VDEV_UPATH" ]; then 23*eda14cbcSMatt Macy MEDIA="file" 24*eda14cbcSMatt Macy fi 25*eda14cbcSMatt Macyfi 26*eda14cbcSMatt Macy 27*eda14cbcSMatt Macyecho "media=$MEDIA" 28