About a week ago I bought a Seagate FreeAgent 320Gb external USB drive for my Linux box thinking that I could dump my mp3 files to it as well as backup my documents, pictures, et al to it as well. For the price, it was a great buy and I’ve been pretty happy with the performance. However, I noticed that occasionally Amarok would no longer see the music library and would error out all my songs. This was…annoying. Normally I could fix it by just browsing to the drive and magically everything would work fine.
Strangely, it seemed that the drive was offlining itself, automatically, after an extended period of non-use. Apparently, I’m not alone with this issue either. I have to give Diane props for finding the fix but i’m going to repost it here to clear things up a bit.
I’m running Ubuntu, Gutsy Gibbons (7.10) to be precise. This should work equally well for other versions of Ubuntu as well (and other distributions but your method of getting the needed application will vary). First, we need to grab the sdparm package from the repositories. Open up a terminal window and type:
chris@hooby:~$ sudo apt-get install sdparm
You’ll then see some scrolling output as it grabs and installs the sdparm utility which basically allows you to output and modify the parameters for scsi (USB hard drives, SATA drives, and dvd/cd burners are seen as SCSI) devices.
Next, you’ll need to find out what the true path to your device is. If you don’t know it (should be something like /dev/sdX where x is a letter a-x) you can disconnect the drive and reconnect it. Then, run
cat /var/log/dmesg
Which should output something similar to this towards the bottom
[ 14.172000] scsi 5:0:0:0: Direct-Access Seagate FreeAgentDesktop 100D PQ: 0 ANSI: 4
[ 14.196000] sd 5:0:0:0: [sdb] 625142448 512-byte hardware sectors (320073 MB)
[ 14.200000] sd 5:0:0:0: [sdb] Write Protect is off
Now, we want to check the current status of the drive so run the following
sudo sdparm -a /dev/sdb (substitute your sdX for my sdb)
which will output the following
/dev/sdb: Seagate FreeAgentDesktop 100D
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]
The “STANDBY” flag is what we’re concerned with. We need to clear that. Now the following command can only be run when the drive is actually spun up but if you did disconnect and reconnect the device it’ll be up and accessible so run
sudo sdparm –clear STANDBY -6 /dev/sdb
There won’t really be much showing that the command succeeded. However, if we run sdparm -a /dev/sdb again we’ll see the following showing that it worked
chris@hooby:~$ sudo sdparm -a /dev/sdb
/dev/sdb: Seagate FreeAgentDesktop 100D
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]
As you can see, the standby flag is now gone. Your drive should no longer go into a sleep mode causing havoc with Linux.