Skip to content

Instantly share code, notes, and snippets.

@D4rk4
Created September 17, 2024 10:31
Show Gist options
  • Save D4rk4/ffb5c3b4f76bafb622e3ab0b33c9e253 to your computer and use it in GitHub Desktop.
Save D4rk4/ffb5c3b4f76bafb622e3ab0b33c9e253 to your computer and use it in GitHub Desktop.
SAS ZFS-friendly settings via udev
# Performance settings (it's defaults in OEM firmware, but need to by ajusted for NetApp disks)
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -s --clear=RCD /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -s --clear=DRA /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -s --set=PERF /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -s --set=WCE /dev/%k"
# Background media scan (for SAS disks)
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s EN_BMS=1 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s BMS_I=48 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s MIN_IDLE=2000 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s MAX_SUSP=500 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s EN_PS=1 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s BPS_TL=6 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s LOWIR=1 /dev/%k"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", RUN+="/usr/bin/sdparm -p bc -s S_L_FULL=0 /dev/%k"
# Hack for "Hardware recovery"
ACTION=="add|change", KERNEL=="sd[a-z]*", ENV{ID_BUS}="scsi", ATTR{queue/scheduler}="none", ATTR{device/timeout}="60", ATTR{device/eh_timeout}="60"
# SSD
ACTION=="add|change", KERNEL=="sd[a-z]*|nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment