PDA

View Full Version : Seagate FreeAgent Desktop USB drive sleeping problems


bbobbo
2007-05-18, 09:25 AM CDT
i have a a 500gb seagate freeagent desktop usb drive which i connected to my fc4 x86_64 server. i used fdisk to delete the ntfs partition and created a single linux partition and formatted it for ext3. the drive is temporarily serving as a /home partition for the server; / and /root are installed on a different system drive.

i started getting i/o problems and saw that the drive got remounted read-only. after googling for solutions, i discovered that the problem was that the drive automatically spins down after 15 minutes. when you try to access the drive after it has spun down, you get i/o errors and then the partition gets remounted read-only:

http://www.nslu2-linux.org/wiki/FAQ/DealWithAutoSpinDownOnSeagateFreeAgent

i tried to implement the solution mentioned, which is:

echo 1 >/sys/class/scsi_disk/0:0:0:0/allow_restart
in my case, the drive is 2:0:0:0. however, when i try to issue the command (yes, i'm logged in as root), i get permission denied:

# echo 1 > /sys/class/scsi_disk/2\:0\:0\:0/allow_restart
-bash: /sys/class/scsi_disk/2:0:0:0/allow_restart: Permission denied

so i have two questions:

1) why am i getting a "permission denied"?

2) while i'm waiting for a solution for 1), i thought i would be clever and create a cron job that would constantly access the drive to keep it from sleeping. first i tried:
*/12 * * * * ls /home > /dev/null 2>&1
that didn't work (drive eventually went into i/o errors). i thought maybe the result was cached so the drive didn't actually have to spin up. so then i tried:
*/12 * * * * date > /home/date.txt 2>&1
that didn't work either. maybe the time-out isn't 15 minutes?
*/1 * * * * date > /home/date.txt 2>&1
still no luck. maybe a larger file needs to be written?
*/1 * * * * dd if=/dev/urandom of=/home/random.txt bs=1K count=1024 > /dev/null 2>&1
nope. maybe the filename needs to be random?
*/1 * * * * dd if=/dev/urandom of=/home/random/random.$RANDOM bs=1K count=1024 > /dev/null 2>&1
0 * * * * rm -f /home/random/* > /dev/null 2>&1
still no luck!?! what's going on? why is the drive still sleeping? why wouldn't my cron jobs reset the spin-down timer?

i know if i do some other kind of file operation that takes a long time (say do a large copy operation either from another drive on the server or over the network, or run some other script that is constantly generating a large number of files), the drive doesn't spin down. i don't know why my cron jobs won't keep the drive awake. any ideas?

Dies
2007-05-18, 10:00 AM CDT
Well, I'll throw some ideas out and hopefully someone with more experience with USB can give you a clear cut answer.

Are you using a label for this drive? if not you may want to try setting a label on it and referring to it by it's label in fstab.

http://www.die.net/doc/linux/man/man8/e2label.8.html

You might be able to write a rule for this drive:

http://www.reactivated.net/writing_udev_rules.html#builtin

Not sure how USB hard drives are handled but you could try hdparm to stop it from sleeping, not sure what this would do for the life of the drive but it might actually extend it ?? or not :D

http://www.die.net/doc/linux/man/man8/hdparm.8.html

Both programs should already be available to you.

bbobbo
2007-05-18, 11:20 AM CDT
well, i've been running the following cron job, and it seems to be keeping the drive awake:

*/1 * * * * dd if=/dev/urandom of=/home/random/random.$RANDOM.$RANDOM.$RANDOM bs=2K count=1024 > /dev/null 2>&1
0 * * * * rm -f /home/random/* > /dev/null 2>&1
i don't know if it's because i increased the file sizes to 2mb, or if it's because i added those extra $RANDOMs in the file name.

bbobbo
2007-05-18, 11:31 AM CDT
Well, I'll throw some ideas out and hopefully someone with more experience with USB can give you a clear cut answer.

Are you using a label for this drive? if not you may want to try setting a label on it and referring to it by it's label in fstab.

http://www.die.net/doc/linux/man/man8/e2label.8.html
yes, i have given the drive the label '/home.temp', and have the following in fstab:

LABEL=/home.temp /home ext3 noauto 1 2
(in case you're wondering about the 'noauto', bootup hangs if it's set to 'default'--i guess the usb drive isn't being initialized in time before it tries to mount the partition).

You might be able to write a rule for this drive:

http://www.reactivated.net/writing_udev_rules.html#builtin
i looked at that link...i'm trying to wrap my head around what this is doing, exactly.

Not sure how USB hard drives are handled but you could try hdparm to stop it from sleeping, not sure what this would do for the life of the drive but it might actually extend it ?? or not :D

http://www.die.net/doc/linux/man/man8/hdparm.8.html

Both programs should already be available to you.
i thought about using sdparm (hdparm doesn't work for usb drives) already after seeing this link:

http://lists.debian.org/debian-kernel/2007/05/msg00191.html

but i couldn't find an sdparm rpm for fc4, so i put that on the back burner. if my cron hack doesn't end up working, i'll look into that again.

thanks for you suggestions.

Dies
2007-05-18, 02:49 PM CDT
http://ftp.riken.go.jp/pub/Linux/dries/fedora/core/4/i386/RPMS.dries/sdparm-1.00-1.fc4.rf.i386.rpm

Check the Dries repo if you find you need deps.

bbobbo
2007-05-18, 03:03 PM CDT
http://ftp.riken.go.jp/pub/Linux/dries/fedora/core/4/i386/RPMS.dries/sdparm-1.00-1.fc4.rf.i386.rpm

Check the Dries repo if you find you need deps.
thanks. i had tried to do a 'yum install' from dries, but it couldn't seem to find anything. i guess i was just too lazy to go find the rpm myself, even though it wasn't that hard! :) i ended up getting the x86_64 version from here:

http://mirrors.ircam.fr/pub/dag/dries/packages/sdparm/fc4-x86_64/?C=N;O=D

seemed to work--thanks for the prod!
# sdparm -al /dev/sdd
/dev/sdd: Seagate FreeAgentDesktop 100D
Direct access device specific parameters: WP=0 DPOFUA=0
Power condition [po] mode page:
IDLE 0 [cha: n, def: 0, sav: 0] Idle timer active
STANDBY 1 [cha: y, def: 1, sav: 1] Standby timer active
ICT 0 [cha: n, def: 0, sav: 0] Idle condition timer (100 ms)
SCT 9000 [cha: y, def:9000, sav:9000] Standby condition timer (100 ms)
# sdparm --clear STANDBY -6 /dev/sdd
/dev/sdd: Seagate FreeAgentDesktop 100D
# sdparm -al /dev/sdd
/dev/sdd: Seagate FreeAgentDesktop 100D
Direct access device specific parameters: WP=0 DPOFUA=0
Power condition [po] mode page:
IDLE 0 [cha: n, def: 0, sav: 0] Idle timer active
STANDBY 0 [cha: n, def: 1, sav: 0] Standby timer active
ICT 0 [cha: n, def: 0, sav: 0] Idle condition timer (100 ms)
SCT 0 [cha: n, def:9000, sav: 0] Standby condition timer (100 ms)

hesama
2009-01-04, 08:11 AM CST
hi
i have maxtor 1T external usb disk .
I use it in redhat el4-64 and i have the same problem the usd disk goes standby.
I used sdparm but the value of STANDBY does not change.
i can use sdparm -al /dev/sda1 and it shows me the information about the usb disk but
when i use sdparm --clear STANDBY -6 /dev/sda1 the value of sdparm does not change.
what could be the problem ?
thank you in advance