]> git.proxmox.com Git - mirror_zfs.git/blob - cmd/zpool/zpool.d/media
zpool iostat/status -c improvements
[mirror_zfs.git] / cmd / zpool / zpool.d / media
1 #!/bin/sh
2 #
3 # Print out the type of device
4 #
5
6 if [ "$1" = "-h" ] ; then
7 echo "Show whether a vdev is a file, hdd, or ssd."
8 exit
9 fi
10
11 if [ -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 else
22 if [ -f "$VDEV_UPATH" ]; then
23 MEDIA="file"
24 fi
25 fi
26
27 echo "media=$MEDIA"