USB Hard Drive Spindown Issue

Post Reply
youghta
Posts: 9
Joined: Tue Sep 01, 2009 2:04 pm

USB Hard Drive Spindown Issue

Post by youghta »

I'm not sure if this is the right place to post this question to, but you have been so helpful so far that I thought I would give it a try.

I have a script that spins down my USB hard drive after 5 minutes of activity using:

sg_start --stop --pc=2 /dev/device

I confirm that the device is down with:

hdparm -C /dev/device

At this point, when I try list the files on this volume, I receive this error:

ls: reading directory .: Input/output error

I noticed that the device was being reassigned when coming out of sleep from /dev/sdb to /dev/sdc, so I wrote a udev rule to assign it a persistent device name /dev/DataDrive1. This worked, and now my my fstab references this device successfully. When coming out of sleep, the device name does not change. However, I still cannot access the volume, and receive the same error.

The only way to fix the issue is either to reboot, or to:
umount /dev/DataDrive1
mount -a

Can anyone please point me in the right direction? Any help would be greatly appreciated.

mingoes
Posts: 2
Joined: Tue Sep 07, 2010 3:29 pm

Re: USB Hard Drive Spindown Issue

Post by mingoes »

I use the following command to spindown my Samsung G2 Portable 640g

Code: Select all

sudo sdparm --flexible --command=stop /dev/sdb

Of course, replace the /dev/sdb with you own device
if you don't have the sdparm package just install it by

Code: Select all

sudo apt-get install sdparm


Works great on my FitPC2i

youghta
Posts: 9
Joined: Tue Sep 01, 2009 2:04 pm

Re: USB Hard Drive Spindown Issue

Post by youghta »

Thanks. Does your drive reassign its device (For example from /dev/sdb to /dev/sdc) upon spin-up?

How do you check the spin status? Another USB drive of mine would tell me the status with hdparm -C, but this one doesn't. I suppose I could go pick it up and see if it's spinning...

Thanks again for the reply...

mingoes
Posts: 2
Joined: Tue Sep 07, 2010 3:29 pm

Re: USB Hard Drive Spindown Issue

Post by mingoes »

No, it does not reassign its device.
My knowledge of linux is limited so I can't tell you how to fix this. I'm sure there are plenty of forum posts discussing this.

To check if my devices indeed did a spindown, I just listened to them :)

I'm wondering how your script works to check for 5 minutes of inactivity, can you post that?

youghta
Posts: 9
Joined: Tue Sep 01, 2009 2:04 pm

Re: USB Hard Drive Spindown Issue

Post by youghta »

mingoes wrote:No, it does not reassign its device.
My knowledge of linux is limited so I can't tell you how to fix this. I'm sure there are plenty of forum posts discussing this.

To check if my devices indeed did a spindown, I just listened to them :)

I'm wondering how your script works to check for 5 minutes of inactivity, can you post that?


I used this little program that I found on Google Code that just calls sdparm, sg_start, or whatever app you use to spin the drive down.

http://code.google.com/p/spindown/

Post Reply

Return to “Ubuntu 9.10”