zdb: fix printf() length for uint64_t devid
[zfs.git] / cmd / zpool / zpool.d / media
blob095ac86dc4d8ed7aac7601bae57c234877e497bd
1 #!/bin/sh
3 # Print out the type of device
6 if [ "$1" = "-h" ] ; then
7 echo "Show whether a vdev is a file, hdd, ssd, or iscsi."
8 exit
9 fi
11 # shellcheck disable=SC2154
12 if [ -b "$VDEV_UPATH" ]; then
13 device="${VDEV_UPATH##*/}"
14 read -r val 2>/dev/null < "/sys/block/$device/queue/rotational"
15 case "$val" in
16 0) MEDIA="ssd" ;;
17 1) MEDIA="hdd" ;;
18 *) MEDIA="invalid" ;;
19 esac
21 vpd_pg83="/sys/block/$device/device/vpd_pg83"
22 if [ -f "$vpd_pg83" ]; then
23 if grep -q --binary "iqn." "$vpd_pg83"; then
24 MEDIA="iscsi"
27 else
28 if [ -f "$VDEV_UPATH" ]; then
29 MEDIA="file"
33 echo "media=$MEDIA"