-
- Posts: 29
- Joined: Sun Feb 05, 2012 5:55 pm
Spinning down HDD?
I've hunted around on various forums but everything seems distro specific.
I'm running the latest debian image from a USB Laptop HDD and want it to spin down when idle for a period of time so the drive doesn't end up dying on me.
I've tried HDParam on it but get SG_IO bad/missing sense data.
Any input is appreciated
I'm running the latest debian image from a USB Laptop HDD and want it to spin down when idle for a period of time so the drive doesn't end up dying on me.
I've tried HDParam on it but get SG_IO bad/missing sense data.
Any input is appreciated
Re: Spinning down HDD?
Lots of useful info at http://www.nslu2-linux.org/wiki/FAQ/Spi ... BHarddisks
I think the ability to spin down depends on both the HDD, and the USB<->HDD interface controller.
I think the ability to spin down depends on both the HDD, and the USB<->HDD interface controller.
Re: Spinning down HDD?
when you get the answer let me know - this was another roadblock on my previous SLUG centred attempt on a silent, low power, near-zero-moving-part home server....
Re: Spinning down HDD?
Yes hdparm is he way to do this. Can make things a tad unstable, when the OS tries to access the hard disk, and it needs to spin up first, things time out.
There are various flags you can pass, -y -Y -s -S, read the man page.
Not all hard drive take all options - but you might as well try. Usually some work.
There are various flags you can pass, -y -Y -s -S, read the man page.
Not all hard drive take all options - but you might as well try. Usually some work.
-
- Posts: 29
- Joined: Sun Feb 05, 2012 5:55 pm
Re: Spinning down HDD?
I tried all night last night, but HDParm kept giving me errors, so I'm tempted to try it in an old USB/SATA bridge from a TrekStor caddy that behaved quite well, in terms of spinning itself down...
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6954
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Spinning down HDD?
Have you tried sdparm?
[moderator removed outdated link]
[moderator removed outdated link]
-
- Posts: 29
- Joined: Sun Feb 05, 2012 5:55 pm
Re: Spinning down HDD?
Yep, it didn't have the standby command listed unfortunately
Re: Spinning down HDD?
what errors out of interestFollowingGhosts wrote:I tried all night last night, but HDParm kept giving me errors ...
I've usually found errors are bcause the HDD doesn't support some options ...
-
- Posts: 29
- Joined: Sun Feb 05, 2012 5:55 pm
Re: Spinning down HDD?
SG_IO errors, considering it's a laptop HDD, I'd expect it to work with sleep...
Re: Spinning down HDD?
Hi
Just been playing around to get my pi set up as a simple NAS and will be syncing files daily for backup. I'm completely new to Linux so it's taken a bit of time to get it working (lot's of reading!), but have managed to get my external HDD to spin down (which never used to even with my Windows machine I use everyday).
At boot I'm running sudo /sbin/hdparm -S120 /dev/sda1 . This shuts down the drive after 10 minutes. When I try to open a folder on the mapped drive, it spins up and allows me to access my files. No errors so far!
For me, this project has proved the value of the Pi - in that it has reignited my enjoyment with playing around with computers - rather than just using them!
Just been playing around to get my pi set up as a simple NAS and will be syncing files daily for backup. I'm completely new to Linux so it's taken a bit of time to get it working (lot's of reading!), but have managed to get my external HDD to spin down (which never used to even with my Windows machine I use everyday).
At boot I'm running sudo /sbin/hdparm -S120 /dev/sda1 . This shuts down the drive after 10 minutes. When I try to open a folder on the mapped drive, it spins up and allows me to access my files. No errors so far!
For me, this project has proved the value of the Pi - in that it has reignited my enjoyment with playing around with computers - rather than just using them!
Re: Spinning down HDD?
I was trying to get my WD My Passport 500GB drive to spin down after 10minutes in Openelec.
I tried various hdparm commands, and found that while I could read various settings from the drive, I could not write any settings back to the drive.
I wanted the drive to power down after 10 idle minutes, in the end the easiest way for me to set this was to connect the drive to a Windows PC, load up the WD Smartware software, and from there set the sleep timer to 10mins.
It worked, when I connected the drive back onto my raspberry pi, it spun down properly after 10 idle minutes.
I tried various hdparm commands, and found that while I could read various settings from the drive, I could not write any settings back to the drive.
I wanted the drive to power down after 10 idle minutes, in the end the easiest way for me to set this was to connect the drive to a Windows PC, load up the WD Smartware software, and from there set the sleep timer to 10mins.
It worked, when I connected the drive back onto my raspberry pi, it spun down properly after 10 idle minutes.
Re: Spinning down HDD?
I have no idea what the following post is fully about but it seems to have something in it I hope this is helpful if not sorry.
http://www.raspberrypi.org/phpBB3/viewt ... 26&t=18626
http://www.raspberrypi.org/phpBB3/viewt ... 26&t=18626
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
Re: Spinning down HDD?
Solid State Disks are getting cheap. $50 or less now for 64GB. $80 or so for 128GB
In my case, the RPi just uses SMB to access shares on my small NAS via the LAN or WiFi LAN.
In my case, the RPi just uses SMB to access shares on my small NAS via the LAN or WiFi LAN.
Re: Spinning down HDD?
All of the media my RPi accesses is via a NAS using the WiFi (no LAN) with a mounted partition(s).
Dweeber A.K.A. Kevin...
My RPI Info Pages including Current Setup - http://rpi.tnet.com
My RPI Info Pages including Current Setup - http://rpi.tnet.com
Re: Spinning down HDD?
I am using an old (7 years?) WD 320 GB Drive with an ICIDU USB3.0 enclosure I picked up at the store yesterday. Gave it a shot.
The persist through reset flags give a bunch of errors:
Running the command without additional flags works fine however:
I can hear it spin down after 10 minutes now.
To set this setting every time the pi boots, I have edited /etc/hdparm.conf:
This is untested as my pi has a few things running and can't just be rebooted. Should work in theory though.
The persist through reset flags give a bunch of errors:
Code: Select all
sudo hdparm -k1 -K1 -S120 /dev/sda
/dev/sda:
setting keep_settings to 1 (on)
HDIO_SET_KEEPSETTINGS failed: Invalid argument
setting drive keep features to 1 (on)
HDIO_DRIVE_CMD(keepsettings) failed: Input/output error
setting standby to 120 (10 minutes)
HDIO_GET_KEEPSETTINGS failed: Invalid argument
Code: Select all
pi@raspberrypi ~ $ sudo hdparm -S120 /dev/sda
/dev/sda:
setting standby to 120 (10 minutes)
To set this setting every time the pi boots, I have edited /etc/hdparm.conf:
Code: Select all
/dev/sda {
spindown_time = 120
}
Re: Spinning down HDD?
To save the sanity of anyone who found this thread...
sometimes the USB controller doesn't support telling the HDD to spindown... thus (if you haven't broken your HDD through overheating already) you need to buy a new USB HDD controller that supports spinning down...
the only question is.... how do you find a cheap USB controller for a 2.5" drive that supports the spindown command?
sometimes the USB controller doesn't support telling the HDD to spindown... thus (if you haven't broken your HDD through overheating already) you need to buy a new USB HDD controller that supports spinning down...
the only question is.... how do you find a cheap USB controller for a 2.5" drive that supports the spindown command?
Re: Spinning down HDD?
I use a USB to 3.5"PATA/2.5"PATA/SATA adaptor with a Jmicron chip. They are very common and cheap on ebay from china (around 2 quid).jago25_98 wrote:how do you find a cheap USB controller for a 2.5" drive that supports the spindown command?
I just tested to see if it supports the spindown settings, and, although hdparm did give a "failed: Invalid argument" message, the setting did work.
Code: Select all
debian:~# hdparm -S5 /dev/sdb
/dev/sdb:
setting standby to 5 (25 seconds)
HDIO_DRIVE_CMD(setidle) failed: Invalid argument
Re: Spinning down HDD?
I'm trying to do achive the external usb hdd spin down.
Each hdparm command always return "SG_IO: bad/missing sense data, sb[]: "
Someone is able to suggest me how to spin down my external usb hdd?
I found out that the "error" message is something normal
I tried
but the drive still turn 
Another edit:
with
or
the drive immediatly stop turning and wake up when need..
Now I have to understand how to configure a delay to run this command and how to run it
Each hdparm command always return "SG_IO: bad/missing sense data, sb[]: "
Code: Select all
sudo hdparm -S5 /dev/sda
/dev/sda:
setting standby to 5 (25 seconds)
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
I found out that the "error" message is something normal

I tried
Code: Select all
sudo hdparm -Y /dev/sda
/dev/sda:
issuing sleep command
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
sudo hdparm -C /dev/sda
/dev/sda:
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
drive state is: standby

Another edit:
with
Code: Select all
sudo sg_start --stop /dev/sda
Code: Select all
sudo sdparm --command=stop /dev/sda
Now I have to understand how to configure a delay to run this command and how to run it

Re: Spinning down HDD?
Great to be getting somewhere on this:
does spin down the drive for me but then it spins straight up again. The drive isn't mounted so I can't see anything trying to access it...
Code: Select all
sudo sg_start --stop /dev/hdc
Re: Spinning down HDD?
My usb hdd is mounted through fstab, my problem is that it only spindown when the command is run and not after x seconds 

Re: Spinning down HDD?
Check this out: http://www.botcyb.org/2009/04/making-in ... -down.htmlmcgyver83 wrote:My usb hdd is mounted through fstab, my problem is that it only spindown when the command is run and not after x seconds
Re: Spinning down HDD?
Great!
I'm going to try this as soon as possible!
Thanks!
I'm going to try this as soon as possible!
Thanks!
Re: Spinning down HDD?
I had to restart from scratch and now I'm not able to install sdparm from apt-get (raspbian jessie).
Any hints?
Any hints?
- DougieLawson
- Posts: 42772
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Spinning down HDD?
I reckon you're going to have to pull the source code and compile it.mcgyver83 wrote:I had to restart from scratch and now I'm not able to install sdparm from apt-get (raspbian jessie).
Any hints?
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Spinning down HDD?
Can I move sorces.list back to wheezy and install sdparm with apt-get?
Compilation done
Usb external HD now is silent
Compilation done

Usb external HD now is silent
