As root, create /usr/bin/usbhdfix, mode 755 with contents:
#!/bin/bash
# Script is in fact called 5 times on SuSE, with different values
# Use grep to find if the values fit an appropriate form and only
# then should we attempt to perform any actions
# Strings fit form of [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}
# Nonetheless, for usb devices the first portion should be enough
id=$(echo $1 | grep '^[0-9]\{1,2\}:[0-9]\{1,2\}')
if [ -n "$id" ]; then
echo 1 > /sys/class/scsi_disk/$id/allow_restart
fi
Using system service
As root, create /etc/init.d/usbhdfix, mode 755 with contents:
#!/bin/sh
# usbhdfix Fix usb hard drive auto spindown issue
# chkconfig: 2345 60 20
# description: Fix usb hard drive auto spindown issue by enable auto_restart
# kernel flag.
case "$1" in
start)
find /sys -name allow_restart | while read i
do
echo $i
echo 1 > $i
done
;;
stop)
echo "Unmounting USB fileystem."
;;
restart|reload|force-reload)
;;
*)
echo "Usage: /etc/init.d/usbhdfix start|stop|restart|reload|force-reload"
exit 1
;;
esac
exit 0
Make it auto start at system boot:
# chkconfig --level 2345 usbhdfix on
Solution 3: Using FreeAgent software provided by Seagate
You should connect the hard drive to a Windows host and install the
FreeAgent tool. Then change the auto spindown time to "nerver". You can also
turn down the light of the drive, which cannot be done under linux.
Seagate FreeAgent drive auto spindown under Linux solutions
I bought a Seagate FreeAgent Pro hard drive, but find it doesn't work well under Linux. After some investigation, I find the following solutions.
Solution 1: Turn off the auto spindown/spinup ability of external drive.
# sdparm -a /dev/sdb /dev/sdb: Seagate FreeAgent Pro 400A Power condition mode page: IDLE 0 [cha: n, def: 0, sav: 0] STANDBY 1 [cha: y, def: 1, sav: 1] ICT 0 [cha: n, def: 0, sav: 0] SCT 9000 [cha: y, def:9000, sav:9000] # sdparm --clear STANDBY -6 /dev/sdb # sdparm -a /dev/sdb /dev/sdb: Seagate FreeAgent Pro 400A Power condition mode page: IDLE 0 [cha: n, def: 0, sav: 0] STANDBY 0 [cha: n, def: 1, sav: 0] ICT 0 [cha: n, def: 0, sav: 0] SCT 0 [cha: n, def:9000, sav: 0]To restore the default value:
Solution 2: Make the drive auto restart.
Using Udev
Get drive info by udevinfo:
As root, create /etc/udev/rules.d/85-usb-hd-fix.rules with contents:
SUBSYSTEMS=="scsi",DRIVERS=="sd",ATTRS{vendor}=="Seagate",ATTRS{model}=="FreeAgentPro",RUN+="/usr/bin/usbhdfix %k"As root, create /usr/bin/usbhdfix, mode 755 with contents:
#!/bin/bash # Script is in fact called 5 times on SuSE, with different values # Use grep to find if the values fit an appropriate form and only # then should we attempt to perform any actions # Strings fit form of [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} # Nonetheless, for usb devices the first portion should be enough id=$(echo $1 | grep '^[0-9]\{1,2\}:[0-9]\{1,2\}') if [ -n "$id" ]; then echo 1 > /sys/class/scsi_disk/$id/allow_restart fiUsing system service
As root, create /etc/init.d/usbhdfix, mode 755 with contents:
#!/bin/sh # usbhdfix Fix usb hard drive auto spindown issue # chkconfig: 2345 60 20 # description: Fix usb hard drive auto spindown issue by enable auto_restart # kernel flag. case "$1" in start) find /sys -name allow_restart | while read i do echo $i echo 1 > $i done ;; stop) echo "Unmounting USB fileystem." ;; restart|reload|force-reload) ;; *) echo "Usage: /etc/init.d/usbhdfix start|stop|restart|reload|force-reload" exit 1 ;; esac exit 0Make it auto start at system boot:
Solution 3: Using FreeAgent software provided by Seagate
You should connect the hard drive to a Windows host and install the FreeAgent tool. Then change the auto spindown time to "nerver". You can also turn down the light of the drive, which cannot be done under linux.
Reference
Feeds
Tags
gtd syslog twiki virtualizaion wiki xenCopyright © 2010 Zhigang Wang. Some right reserved.