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, or ssd." 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 21else 22 if [ -f "$VDEV_UPATH" ]; then 23 MEDIA="file" 24 fi 25fi 26 27echo "media=$MEDIA" 28