DarkSoul4242

Disable spindown

Jan 14th, 2021
517
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # Based on https://serverfault.com/questions/1047331/how-do-i-disable-hard-disk-spin-down-or-head-parking-in-freebsd
  3.  
  4. for i in /dev/da* ; do
  5.     dev=`basename $i`
  6.     if (camcontrol identify $dev | tr -s '[:space:]' | tr '\t' ' ' | grep "advanced power management yes" >/dev/null) ; then
  7.         echo "Disabling APM for $dev"
  8.         camcontrol apm $dev
  9.     fi
  10.     if (camcontrol identify $dev | tr -s '[:space:]' | tr '\t' ' ' | grep "extended power conditions yes yes" >/dev/null) ; then
  11.         echo "Enabling EPC for $dev"
  12.         camcontrol epc $dev -c enable
  13.         for state in standby_z idle_b idle_c standby_y ; do
  14.             echo "Disabling EPC $state for $dev"
  15.             camcontrol epc $dev -c state -d -p $state
  16.         done
  17.     fi
  18. done
RAW Paste Data