view · edit · print · history

Not everyone wants a harddisk running 24/7. A noisy hard disk can be awful and the lifespan of a permanently running HD is shorter, too.

Warning: As described here, most disks do not tolerate a large number of spinups. So you may not want to spin down if spinups will be more than every hour or so.

Quick Summary
Method 1 - Use hdparm on linux pc
Method 2 - Enclosures with integrated HD
Method 3 - Use scsi-idle
Method 4 - Use sg_start with debianslug or openslug
Method 5 - Use hd-idle with Debianslug
Method 6 - Unmount disks and suspend USB port
System file modifications to reduce disk access (hence allow spindown)
Adapters which support start-stop
Adapters which do NOT support start-stop

Quick Summary

First you need to get a hard disc to spindown (the easiest way is to buy a disc which spins down itself). Second you need to tweak/add various system files to reduce disk access.

  • Method 1: Temporarily connect the drive via its IDE connector directly to another Linux box and run hdparm to set the spindown timer (the -S option is what you're looking for, PLEASE read the hdparm man page before even thinking about running it)[OS independent]. You need an enclosure with separate power and IDE connectors to do this.
    • Advantage: Can be used on every HD which supports standby regardless of the OS.
    • Disadvantage: Every time you turn off your HD or there is a power loss you have to repeat the procedure if your drive doesn't support he KEEP_OVER_RESET-flag.
  • Method 2: Buy a HD/enclosure combo which supports down-spinning by itself (e.g. Maxtor OneTouch series, WD Essential Drives)[OS independent]
  • Method 3: Use scsi-idle. [Openslug, Unslung].
  • Method 4: Use sg_start [Debianslug, Openslug]
  • Method 5: Use hd-idle [Debianslug]
  • Method 6: Unmount disks and suspend USB port [NSLU2 support not discovered yet]

All methods most often require modifications concerning the syslog- and other daemons because of their behaviour of writing time-marks into their log-files (especially syslog), as this will cause your HD to spin up at certain intervals.

Method 1: Use hdparm on a Linux PC

Any drive can have a spindown time-out, provided:

  • The disk can take 'hdparm -S120 /dev/hdx' and spindown after 10 minutes.
  • It is possible to attach the drive to the IDE interface on your PC while using the power from the USB-IDE adapter.

For various technical reasons it is generally not possible to adjust the standby timer of an IDE disk connected through a USB adapter (including turnkey external USB drives). See the sdparm page for the technical reasons.


  • Hard disk with separate IDE and power connectors, eg, some IcyBox models.
  • Another Linux machine to connect it to with hdparm installed.

1) Take your HD and install it the enclosure (especially the power connector to the drive).

2) Turn on your enclosure.

3) Disconnect the enclosure's IDE connector (if connected) and connect the other Linux machine's IDE connector to the HD.

4) Set the spindown-time 'hdparm -k1 -K1 -S120 /dev/hda' where -Sxx specifies the spindown-time. -k1-K1 set the keep over reset-flags if supported.

5) Disconnect the Linux machine's IDE connector.

6) Connect the enclosures IDE connector to the HD without removing the power from the HD!

This way the drive is never reset, and will keep its spindown setting. Of course if hdparm -k1 -K1 -S120 actually makes your drives remember their settings this is irrelevant, but for anyone like me whose drives wont remember their settings this is a way to make them spindown.


Unknown:For those with enclosures that wont let them do this, I use this. The IDE-USB and power supply are completely separate, which make this easy.

ST: Bought an enclosure with internal SATA interface and external SATA/USB interface IcyBox IB-360StUS-B and installed a Samsung 250GB SATA II (SP2504C) into it. Connected it via SATA (MB to external slot-connector is included) to my big machine and ran hdparm. Voila, the disk spins down.

Variant: You can download the Power Booster utility for 2.5" IBM/Hitachi TravelStar disks. The Power Booster utility will enable the auto spin down feature of the disk. For 3.5" IBM/Hitachi drives (and maybe others), you can download the Feature Tool. Otherwise temporarily install the IDE disk in your ordinary Linux box, read the disk technical documentation and use hdparm to adjust the settings by hand. The trick is to enable APM within the drive itself, so Linux doesn't have to care about it at all. You can't use hdparm to alter the APM settings from the NSLU2 as the USB->IDE adapters are emulated as SCSI host adapters in the Linux kernel which is incompatible with the necessary hdparm options.

[Request by ingeba]: To my knowledge this does not work. Can anyone verify that APM settings may cause NSLU2 connected drives in arbitrary enclosures to spin down? If so, please list drive and enclosure brand here:

  • [slavikb] This worked for me (Hitachi 7K250, noname box, Feature Tool). I had to remount root with -noatime option. The drive goes into Low RPM mode after 10 minutes of inactivity.

Either way, you'll have to open your 2.5" USB enclosure and install the disk drive temporarily to a desktop computer using a 2.5" to 3.5" IDE adapter. After that, you can do the APM adjustment in Windows or Linux.

[Anguel]: As far as I see from the Hitachi specs only 2.5" drives with Enhanced Adaptive Battery Life Extender 3.0 technology will really spin down. All other 2.5" and 3.5" drives will only go into Low RPM mode but will not stop spinning completely. Request: Can someone please confirm that 2.5" Hitachi drives will keep their APM spindown settings permanently after being set once with the Power Booster utility under Windows. -- Anguel

[dfsmith]: As the original author of Power Booster, I can tell you that it only sends the appropriate "set feature" command to the ATA drive. This is not generally preserved on a power cycle. It should work on any drive that supports ATA-ATAPI 4 or later (and is one of the commands that some USB<->ATA chipsets remove). The Feature Tool goes to a much lower level, and writes the drive's persistent configuration data. (At least, that's my understanding, a different department wrote that tool.) One note: to enable spindown, the Advanced Power Management setting (on hdparm or Power Booster) must be < 0x80. Also, no drives that I know of have a low RPM mode, but they do have idle modes where the actuator is powered down. (I've found turning off syslog and mounting / -o noatime spins down my Seagate external drive. Samba logs spin the drive up every few hours though.)

Method 2: Enclosures with integrated HD

For Maxtor OneTouch drives (also for Western Digital MyBook drives) see the Maxtor OneTouch HOWTO.

For Seagate Desktop FreeAgent see the Seagate FreeAgent HOWTO.

I just bought a Seagate Barracuda 3.5" drive and installed it in a third party enclosure. Upon contacting their tech support in Europe they stated that:

  • Seagate does not support other power management than managed by the running OS
  • Seagate does not support drives to be installed in third party enclosures
  • Seagate disks do not have a function to retain the power management settings

So I guess my advice would be not to buy the Seagate disks.

Some disks power down out-of-the-box. If you have a USB disk which does this, extend this list please.

  • 13.03.2006: WesternDigital Essential 320 GB USB 2.0 / 3.5" / 7200 rpm (All WD Essential drives seem to implement this feature)
  • 24.03.2003: Maxtor One Touch - 200 Go USB 2.0 / 3.5 " / 7200 rpm
  • 11.05.2006: Seagate 250GB USB 2.0 / 3.5" / 7200 RPM
  • 27.12.2007: Western Digital Elements 500 GB USB 2.0 / 3.5" (WDE1U5000) spins down after a few minutes of inactivity on the NSLU2 as well as my desktop. Additionally I can use "sg_start --stop /dev/sda", "sdparm --command=stop /dev/sda" or "hd-idle -t sda" to spin it down anytime.
  • 08.01.2008: Western Digital Elements 320 GB USB 2.0 / 3.5" spins down successfully on Unslung 6.8 beta.
  • 30.01.2008: Seagate Freeagent Pro 750 GB comes with a pre-defined spindown of 5 minutes. The Seagate Tools allow to change this time - but only when connected directly to a Windows Box, and the drive doesn't remember the settings itself: when connecting it to another computer it reverts to 5 minutes.
  • 25.03.2008: Western Digital Elements (www.wdc.com), WD Elements external hard drive 500GB, USB 2.0, MDL:WD5000E035-00, R/N:A5G, S/N: WCASU0052829, Formated as EXT3 from NSLU2, Spin down automaticaly after a while without any setup or changes.
  • 24.06.2008: Welland GreenStar enclosure spins down after 3 minutes and powers off after another 2 minutes. (Any hard drive should behave similarly but tested with Samsung HD321KJ.)
  • 13.12.08 List of | Western Digital USB external disks(approve sites) that spin down after 10 mins of inactivity.
  • 03.06.09 I have the NSLU2 with a WD Elements 1TB drive. At first I had unslung, but then went to debian for spindown. After my debian crashed and wouldnt come back up I chose (OK, I didn't want to take the time for another debian install...) :) to install SlugOS on a flash thumbdrive and mount the drive seperatly. Works like a charm. Every 10-15 mins. a spindown. Yay. Thanks for SlugOS!


  • Note by Anguel Stankov: I have a Western Digital MyBook Essential 500GB. The drive spins down with Unslung 5.5 only (I have no additional packages installed and I don't use any additional spindown scripts). Unfortunately I cannot make spindown work with Unslung 6.8 or original Linksys firmware v23RA5. This spin-down problem is also reported in the "nslu2-general" newsgroup.
  • I have a WD MyBook 250GB and I have never had any problems like that. It spins up and down like it should. I'm running unslung 6.8. - Tobbe 2006-12-19
  • Question to Tobbe: Please tell us if you are using additional spindown scripts.
  • like Tobbe: WD MyBook 250 on Disk 1, Unslung 6.8 to Stick on Disk 2 + Ext3flash, no additional spindown scripts, landeshauptbill 2007-02-24
  • I have a Western Digital MyBook Essential 500GB (like Anguel). The drive span down with the original firmware, but once upgraded to V2.3R63 of the linksys firmware it did not seem to spin down anymore (but I did not fully test at this stage - just noted in passing). Following the installation of Unslung 6.8 onto a 4GB usb microdive on port 2, I can confirm that the MyBook on port 1 never spins down. Richard 2007-02-25


  • I am also unsuccessful in making my MyBook 500GB spindown at all. I've tried the /dev /var, noatime and crontab modifications suggested here, but there is still disk access every ~2nd second at a regular pattern. The same disk access pattern is heard if I boot the NSLU2 with no disks attached and then attach the MyBook.


  • I also have similar issues with the WD MyBook 500GB Essential External Drive. I tried all the suggestions provided on various forums and Wikis and have also tried starting up the bare minimum processes on the NSLU2 with no success. For those who were successful spinning down the WD Essential drive if they could please describe their configuration and what they did and didn't do. Like others I have the WD MyBook 500GB Essential attached to port 1 and a Lexar Jump Drive with Unslung 6.8/Ext3flash attached to port 2. My belief is that folks who have successfully spun down the drive have a ext formated drive on their WD. I have a NTFS formatted drive mounted as ufsd. My NSLU2 is using V2.3R63 firmware/Unslung 6.8. Has anyone tried using the beta V2.3R72 firmware (Looks like there is now a R73 release available) on Unslung 6.8?
  • In addition I also have a 500GB WD MyBook Essential, connected to port 1. With firmware R63 the drive does not spin down, downgraded to R29 it spins down as expected. 2007-03-28


  • I have a Western Digital MyBook Premium 320GB with NTFS partition on port1 (root fs on flash disk port2). Running Unslung 6.8. Same problems as above with strange disk activity ~2 seconds which cause the drive to never spindown.


  • I have a WD MyBook standard edition 500GB and I am facing the same problem with a V63 firmware and Unslug 6.8. The only way I can make it spindown is to unmount the file system!


  • Firmware Version: V2.3R63-uNSLUng-6.8-beta with Western digital 750GB Essential model WD7500c032: no problem about spin down of HD. It turns on/off automatically when needed.


  • Firmware Version: V2.3R63-uNSLUng-6.8-beta with Western digital 500GB Essential model formatted as NTFS. Automatically spins down in about 10 minutes.


  • Firmware: uNSLUng-6.10-beta. Unslung to Western Digital 1TB MyBook Essential on Port2. Spins down after 10 minutes using scripts from SetSpinDownTimeOnMaxtorOneTouch (with "return 1" uncommented and killall modifications).

2008-05-01: I have a WD My Elements 250Gb drive. I have tried several times using instructions on this page, but it would never spin down. At last i wrote to WD. The answer form WD customer service and support was: "WD MyBook drives are the only externals we make with automatic spin down functionality. We did not implement that feature in our Passports and Elements drives." The answer seems to be in contrary to the expieriences listed above.

Method 3: Use scsi-idle

Robert Demski provided a kernel patch as well as a user-space package to be used on the slug. Install the scsi-idle package to use this method. See also this blog post. (The scsi-idle patch is now included in the SlugOS kernels.)

Note for SlugOS: You can now activate automatic spindown functionality by editing the /etc/default/scsi-idle file.

How to use scsi-idle without kernel patch

By Ruud Senden

I've managed to automate spindown using scsi-idle without the kernel patch. I've created the perl script listed below based on a script I found at http://www.rootfs.net/jaws/index.php?gadget=Blog&action=SingleView&id=22:

#!/usr/bin/perl -w

$statfile = "/proc/diskstats";
die "$0: Cannot read $statfile\n" unless -r $statfile;

$| = 1;
($disk, $interval) = (@ARGV);
$disk =~ s,/dev/,,;
print "$0: disk: $disk, interval: $interval\n";

$halted_data = $last_seen = '';
while (1) {
  open(STATUS, $statfile);
  ($_) = grep(/^\s+\d+\s+\d+\s+$disk\s/o, <STATUS>);
  close STATUS;

  if ($last_seen eq $_ && $halted_data ne $_) {
    print "Spinning down: $disk\n";
    system "scsi-stop", "/dev/$disk";
    $halted_data = $_;
  $last_seen = $_;
  sleep $interval;

Basically what this script does is take a device as the first argument, and an interval in seconds as the second argument. Every interval seconds it will look at /proc/diskstats for the given device, and if the status didn't change the disk will be spun down. The disk will automatically spin up again when accessed (on my system at least).

Installation instructions:

  1. Install perl
  2. Install the scsi-idle package, which can be downloaded from the Yahoo Files section
  3. Save the perl script listed above to your filesystem, for example named autospindown. Make sure the script is executable: chmod +rx autospindown
  4. Edit /etc/default/scsi-idle to list the timeouts for your drive(s), see the instructions in that file for more information.
  5. Edit /etc/init.d/scsi-idle, changing the DAEMON variable to point to the perl script you saved in step 3.
  6. /etc/init.d/scsi-idle start

Note - the file "/proc/diskstats" does not exist on Unslung 5.5, so this technique won't work directly on Unslung boxes. There is however a method that can be used on unslung, this is detailed below.

Shell-only scsi-idle without kernel patch

By Chris

Using Ruud's idea, except implemented as a shell script so you don't need Perl (which is great, but takes a lot of space if you're running from flash only). This seems to work fine with the vanilla OpenSlug firmware, a ByteCC 2.5" external enclosure, and a Seagate 40GB 2.5" drive.

If you use Unslung 6.8 it does not provide /proc/diskstats which this script relies on. Therefore you need to replace the occurances of /proc/diskstats in the script with /proc/stat, which contains similar information. You also need to change the search string for grep. If you only have one disk connected the simple solution is to change the grep commands to "grep disk_io /proc/stat". This solution works with Unslung 6.8 using a LaCie Porsche USB drive (250 GB Hitachi hard drive).

This version updates the status more often than the Perl version which prevents waiting almost a complete extra interval cycle under certain circumstances. Feel free to hack this script and make it better as I didn't spend much time on it.



state=`grep " $disk " /proc/diskstats`

while [ true ]; do
   sleep 10
   newstate=`grep " $disk " /proc/diskstats`
   if [ "$state" = "$newstate" ]; then
      if [ $count -lt 0 ]; then
         if [ $up = 1 ]; then
            #echo -e "spin-down\t" `date`
            state=`grep " $disk " /proc/diskstats`
            scsi-stop /dev/$disk
      #echo -e "drive is up\t" `date`


Stripwax adds: The scsi-idle package and the perl script above follow the convention that the drive to idle is e.g. "dev/sda" whereas the before seems to want to expect just e.g. "sda". In my opinion you will need to change the line "disk=$1" below to something like "disk=${1#/dev/}" or similar

A.I. Here is my version. It handles multiple disks, logs spindowns, checks its argument count and makes sure it's a single instance. Parameters: time interval in seconds and devices to check/spindown. For example: idle.sh 900 sda1 sdb1


if [ $# -lt 2 ]
    echo "idle.sh: not enough arguments supplied"
    exit 1

ps | grep 'idle.sh' | grep -v grep > idle.pid
pids=$(cat idle.pid | cut -d ' ' -f 1)
for pid in $pids
   if [ $pid -ne $$ ]; then
      echo "idle.sh: already running, exiting"
      rm -f idle.pid
      exit 2
rm -f idle.pid


for i
    state[$c]=`grep " $i " /proc/diskstats`

while [ true ]; do
   sleep $sleeptime
   for i
      newstate[$c]=`grep " $i " /proc/diskstats`
      if [ "${state[$c]}" = "${newstate[$c]}" ]; then
         if [ "${count[$c]}" -lt 0 ]; then
            if [ ${up[$c]} = 1 ]; then
               echo -e "$i spin-down\t" `date` >> idle.log
               state[$c]=`grep " $i " /proc/diskstats`
               scsi-stop /dev/$i

Spindown daemon without kernel patch for Unslung

By Vladimir

The spindown daemon periodically looks at I/O disk activity statistics available in /proc/stat. A disk idle condition is detected if the disk statistics aren't changed for a while. Once the disk idle time out is reached, the program sends a SCSI motor control command in order to spin down the disk motor.

This solution works with Unslung 6.8 using a FREECOM External USB drive (400 GB Samsung hard drive).

See http://vladimir.grouzdev.free.fr/public/spindown.

Comment by MoD
Seems to work on a Fantec case with SAMSUNG SP1614C? in it.
Comment by BenMcDui
Vladimir, this works very well on my Iomega-USB 500GB on Port 1. Spassiba!
Comment 2 by BenMcDui
Do *not* disconnect or switch off your disk in spun down state; your Slug gets confused and you may come into trouble as it does no longer recognise your HDD. Activate the HDD first, or power down your Slug (the disk then starts up first (to say goodbye or so?)).
Comment 3 by BenMcDui
It DOES work on an ext3 disk, but NOT on an fat disk. Vladimir, any idea, could you expand your explanation a bit, how does your method compare to the other methods on this page?
Comment by Paul
Although promising and elegant solution, in contrast with Ben this does not seem to work with my Iomega-USB 500GB on Port 1 (Iomega MDHD500-UE)
BenMcDui asks
Paul, is your disk ext3, fat, ntfs?
Paul says
It's an ext3. Sorry for providing incomplete information.
BenMcDui says
I have discovered that it only works under the condition that you boot the Slug, and *only* after bootup, connect the disk.
Works with Buffalo DriveStation 500GB connected as sdb via USB Hub. After 5 minutes (300 seconds, as specified), the disk clicks and goes to standby mode.
Does not work for Seagate ST3500630AS installed into Icy-Box IB351U-BL. This is connected as sde to the same USB Hub.
bitbucket says
It's working with a Maxtor 300GB drive in a Antec MX-100 box, connected as sdb through a USB hub on Port 1. Drive spins back up when accessed. Thanks!
Comment by `florin
Works fine with Samsung HD250HJ? and Seagate ST3250823AS? in Vantec NexStar3? enclosures, and Western Digital WD5000AAKS? in BYTECC BT-380SATACOMBO enclosure.
Comment by Hendrik - Jan2009
Works fine with NSLU2 and both TrekStor? drives that I own, but with SATA WD CaviarGP? 1TB WD10EACS? "Green" Drive, 500GB, with a SATA-USB adaptor, I first thought it would work, but that was wrong. That combo was supposed to save lots of power :-) Box ads say "Cool. Quiet. Eco-friendly! and I planned to run it 24/7/365. Anyway. The drives which work fine with spindown are: TrekStor? Model:HDT725032VLAT80? Rev:1.05 (320GB) and TrekStor? Model:DataStation? 8 (160GB). And I'll continue to try to find out what is wrong with my SATA-USB adaptor. Thank you for this nice tool!

4.Method: Use sg_start to spindown usb disk

for OpenDebianSlug 3.10 2.16 kernel:

  install sg3 scsi tools: apt-get install sg3-utils

for OpenSlug get the source and make install locally using a native build environment

  e.g. download the tar.gz from here,
       wget http://ftp.de.debian.org/debian/pool/main/s/sg3-utils/sg3-utils_1.08.orig.tar.gz
       tar -xzvf sg3-utils_1.08.orig.tar.gz
       cd sg3-utils_1.08
       make install

  to powerdown a hdd: /usr/bin/sg_start --stop /dev/sda

Following the manual page sg_start sends so called "power conditions" to the external device. The example above uses only the default condition which apparently works for most drives. However, I had to use the following command to spin my external usb down:

  /usr/bin/sg_start 0 --pc=2 /dev/sda

There are also other "power conditions" which might work for you. It is definetly worth checking the man page.

  The following script should spin down the idle drive using sg_start 
# Script to see if external storage is being used
# if its not being used, place drive in idle
# to change to your own config, change /hd to your mount point

echo "***************`date`********" >> /var/log/power
t=`fuser -c /hd`
if test "$t"
echo "in use" >> /var/log/power
echo "not in use, power down." >> /var/log/power
echo "`sg_start --stop /dev/sdb`" >> /var/log/power
echo $t >> /var/log/power
echo "" >> /var/log/power


by dA

   LaCie 250GB works also with sg3-utils.

  Type: LaCie 250 GB Vendor: SEAGATE   Model: ST3250823A  Rev: 3.03 

See http://nslu2-info.de/forum/showpost.php?p=20987&postcount=42

by asys3

   Chili USb 250 GB works fine with sg3-utils:

  Vendor: USBDisk   Model: RunDisk           Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: WDC WD25  Model: 00BB-00RDA0       Rev: 0000
  Type:   Direct-Access                      ANSI SCSI revision: 00

I tried everything before and nearly gave up. My Western Digital WD25 drive has definitely NO AdvancedPM(i tried it with connecting it via IDE before.). With sg3-utils it works out of the box. Wakes up after any access and spins down, when calling the script above. Works fine here under Debian 4.0 NSLU2 Linux. The last thing for me is to write a cron job to execute the script above every XY minutes. Perhaps anyone can insert a cron job here - I don't know how to write a cron job (yet).

by soapm

 Trekstor maxi g.u. (with Samsung HD204UI) works with sg3-utils

  lsusb: ID 152d:2329 JMicron Technology Corp. / JMicron USA Technology Corp. transcend storejet 25P

Method 5: Use hd-idle to spin down external disks

hd-idle will monitor disk statistics much like the perl and shell scripts above but will do so within a single, small C program. The main reason for hd-idle is to save memory (i.e. a small daemon vs. a shell or perl script and a separate executable to actually spin down the disk) and CPU time.

Please note that the benefits of running a C program vs. a shell or perl script will be most noticable when running a full [Debian] distribution from the hard disk. If both the shell and the tool to stop the disk are stored on flash memory, hd-idle will provide little advantage over the script approaches mentioned above.

More information can be found on http://hd-idle.sf.net

Method 6: Unmount disks and suspend USB port (unproven)

Some devices will not respond to spindown commands at all, but will respond to being unplugged - such as my Freecom Technologies Hard Drive 500Mb (SAMSUNG HD501LJ). In theory this can be emulated by writing to the correct sys bus file, as illustrated here: http://elliotli.blogspot.com/2009/01/safely-remove-usb-hard-drive-in-linux.html(approve sites). I have got this "spindown" to work nicely on a Ubuntu laptop, but not yet on a slug - I include this here in case this triggers some ideas with experienced Linux users. The problem on the slug is that the "power/level" file doesn't appear to be there (Debian Etch). Maybe this is in Lenny?

System modifications

A Linux system usually has many processes that access that disk from time to time. These need to be tweaked, otherwise they will cause the drive to spin up very often. Basically, you need to either disable the offending file accesses (by turning off or reconfiguring daemons), or move the files being written elsewhere, for example to a USB stick, a network mount, or a tmpfs (only for volatile data).

Here is a list of things that you may need to do, depending on your system and the packages installed:

  • Add the noatime mount option in /etc/fstab to all partitions on the disk. This will prevent the disk from waking up for cached read access, just to update the 'last access time' flag of the file. This method will not work in Unslung 6.8, since /etc/fstab is overwritten at reboot. Instead you can make a boot script (I call it /opt/etc/init.d/S90noatime) which remounts the partions with noatime. The commands you need in the script are mount -o remount,noatime /dev/sda1 and mount -o remount,sync,noatime /dev/sda2.
  • syslogd generates periodic 'MARK' timestamps unless disabled by adding the -m0 command line option (in /etc/default/syslogd on Debian systems, /etc/inittab on Unslung systems).
  • Disable or move some of the log files (in /etc/syslog.conf), but keep in mind that logs are often very useful. A nice solution is to have syslogd send everyting over the network to a remote host.
  • Change nmbd (a samba process) so that is is *not* a local master. In the file /etc/samba/smb.conf add these lines to the [global] section:
# disable local master provision so that nmbd doesn't spin up disk
#preferred master = yes # previous setting
preferred master = no
domain master = no
local master = no
os level = 0
  • [Unslung] Cron runs an hourly syncronization of the system clock (hwclock) and three times a day it checks if the disk is full. Whenever cron executes a job it is logged in /var/log/messages, which causes the disk to spin up. Since these jobs are not vital for your slug, you can avoid this spin up by editing /etc/crontab so the jobs are only run once a day. These lines in crontab will run hwclock and CheckDiskFull once a day (at midnight):
0 0 * * * root /usr/sbin/CheckDiskFull &>/dev/null
1 0 * * * root /usr/sbin/hwclock -s &>/dev/null
  • [Debian] Adding RAMRUN=yes and RAMLOCK=yes to /etc/default/rcS will make Debian put your /var/run and /var/lock in a tmpfs instead of on disk.
  • [Debian]
  • See this page for how to find out which process is causing your disk to spin up.

Move /dev and /var to RAM.

Note: It seems to be overkill to move all of /var to RAM. It may be better to follow the instructions above, and handle the remaining offending processes one by one. Also, if you use udev (like Debian does) then /dev is no longer on disk. See above for the built in method for Debian to move /var.

Debianslug: See above. For historic interest the script below works with debianslug so long as you uncomment the highlighted line (devpts needs to be remounted otherwise on login ssh can not start a shell giving a 'Server refused to allocate pty' error). The script only copies /dev and /var/log but you would do well to tweak /etc/syslog.conf and /etc/logrotate* to be as economical as possible.

The challenge

The challenge is to create a script that will copy all files from /dev and /var/log (or /var) into the RAM resources you created, each time you boot the NSLU2.

Some arguments

  • Some prefer to mount the full /var into ramfs. Other prefer to mount only /var/log

Make your own choice and change the VARMOUNTPOINT variable to choose which directory to mount

  • Some commands should be run for debian slug only

Change the DEBIANSLUG variable to choose.

  • Some commands should be run to optimize the swap but are not accessible from all slugs

Change the RUNFULLSWAPCOMMAND variable to choose.

The procedure

  • Create the following _mount_var_dev.sh script in /etc/init.d :
# /etc/init.d/_mount_var_dev.sh
# Script section to create ramdisk for /var and for /dev

# Constants

# The directores that will be mounted in ramfs
# -------------------------------------------
# should be /var or /var/log
# do not end the path with /


# Booleans indicating whether local ${VARMOUNTPOINT} and ${DEVMOUNTPOINT} should still be accessible
# --------------------------------------------------------------------------------------------------


# 0 if you do not want to access the local directories, 1 otherwise
# The local directories can be accessed through /dev.state and ${VARMOUNTPOINT}.state

# Boolean indicating whether to run a command to use the full swap (/sbin/sysctl -w vm.overcommit_memory=1)
# ----------------------------------------------------------------
# 0 if you do not want to run the given command, 1 otherwise
# From JNC : this command does not exist on my slug (release 2.7)
# From KenP: doesn't work on V2.3R63-uNSLUng-6.10-beta either, I think it fell out of BusyBox somewhere along the road...

# Boolean indicating whether to run command dedicated for debian slug (mount devpts /dev/pts -t devpts)
# -------------------------------------------------------------------
# 0 if NOT running Debianslug, 1 otherwise

# disable the oom-killer to use the full swap
        echo "Running the full swap command"
        /sbin/sysctl -w vm.overcommit_memory=1
        echo "Skipping the full swap command"

# Mount ${VARMOUNTPOINT} to ramfs
/bin/echo "Creating ramfs for ${VARMOUNTPOINT}"
/bin/mount -t ramfs ramfs /mnt -o maxsize=256

echo "Copying files from ${VARMOUNTPOINT} to ramfs"
/bin/cp -rp ${VARMOUNTPOINT}/* /mnt/

# keep the original ${VARMOUNTPOINT} accessible if requested
        echo "Original ${VARMOUNTPOINT} is still accessible in ${TARGETLOCALVAR}"
        /bin/mount -o bind ${VARMOUNTPOINT} ${TARGETLOCALVAR}
        echo "Original ${VARMOUNTPOINT} is not accesible any longer"

# Mount the ramfs to the given directory
/bin/mount -o bind /mnt ${VARMOUNTPOINT}
/bin/umount /mnt

# Mount ${DEVMOUNTPOINT} to ramfs
/bin/echo "Creating ramfs for ${DEVMOUNTPOINT}"
/bin/mount -t ramfs ramfs /mnt -o maxsize=256

echo "Copying files from ${DEVMOUNTPOINT} to ramfs"
cd /dev
find . -print0 | cpio -p -0 -d -m -u /mnt
# you can not use cp command for /dev

        echo "Original ${DEVMOUNTPOINT} is still accessible in ${TARGETLOCALDEV}"
        /bin/mount -o bind /dev /dev.state
        echo "Original ${DEVMOUNTPOINT} is not accessible any longer"

# Mount the ramfs to the given directory
/bin/mount -o bind /mnt /dev
/bin/umount /mnt

# Run dedicated commands for Debian slug if requested
if [ ${DEBIANSLUG} -ne 0 ]
        echo "Running dedicated commands for Debian slug"
        mount devpts /dev/pts -t devpts
        echo "Dedicated commands for Debian slug are not run"

# Return and continue execution of system rc.
return 1

# [EOF]
  • chmod 0755 _mount_var_dev.sh
  • cd /etc/rcS.d

(this directory contains all scripts for a generic 'Start' run-level, that is run before running level 3)

  • ln -s /etc/init.d/_mount_var_dev.sh S37mount_var_dev.sh

(try to do that after activating swap!)

* edit /etc/syslog.conf and remove the /dev/xconsole entry (only used for X11 logging)

  • reboot

It is done, you can check using the mount command that /dev and /var are now in RAM. Your disk will spindown with the timer you specified.

NOTE: This works fine on my Unslung6.8 slug (with the script in /opt/etc/init.d). Mount now returns:

/dev/sda1 on /share/flash/data type ext3 (rw,noatime)
/dev/sda2 on /share/flash/conf type ext3 (rw,sync,noatime)
/dev/sdb1 on /share/hdd/data/HDD_1_1_1 type ufsd (rw)
ramfs on /var/log type ramfs (rw)
ramfs on /dev type ramfs (rw)

Spinning down with sdparm

This requires an IDE-USB adapter that supports the SCSI start/stop command.

To stop the drive:

 # sdparm --command=stop /dev/sdb
 /dev/sdb: SAMSUNG   SP1604N           TM10

The drive is started by any disk access, or this command:

 # sdparm --command=start /dev/sdb
 /dev/sdb: SAMSUNG   SP1604N           TM10

Adapters which support start/stop

These are reported to work. Please add complete model details to this list, including USB ID numbers (see /proc/bus/usb/devices).

  • 20 April 2011

lsusb says: ID 05e3:0718 Genesys Logic, Inc. IDE/SATA Adapter

P:  Vendor=05e3 ProdID=0718
S:  Manufacturer=Genesys Logic
S:  Product= SATA, PATA, USB Combo

Bought in e-Bay (1st try). Works with hdparm BUT NOT THROUGH USB 2.0 HUB. Tried 4 different HUBs?, none of them worked normally. It stops with hdparm -Y (and -y) but after spinup connection lost. Probably it is some timing problem: dmesg said buffer.c "paniced". Only reboot helps... Through USB 1.1 HUB or connection to root HUB it is OK.

  • 20 April 2011

lsusb says: ID 152d:2338 JMicron? Technology Corp. / JMicron? USA Technology Corp. JM20337? Hi-Speed USB to SATA & PATA Combo Bridge

P:  Vendor=152d ProdID=2338
S:  Manufacturer=JMicron
S:  Product=JM20337 e-SATA, PATA, USB Combo

Bought in e-Bay (3rd try). Works with hdparm though USB HUB, although my OpenWRT? Backfire (10.03.1-rc4, r24045)

 "HDIO_DRIVE_CMD(sleep) failed: Invalid exchange"
  • 15 Sept 2009
P:  Vendor=152d ProdID=2329 Rev= 1.00
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge
S:  SerialNumber=5E2F12FFFFFF

Another 2.5" Icy-Box enclosure (USB/eSATA) IB-290StUS-B with JMicron? USB-bridge. Used in conjunction with a Seagate Momentus 5400.6 500GB drive. Spins down flawlessly with sdparm.

  • 12 april 2009
P:  Vendor=152d ProdID=2339 Rev= 1.00
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge
S:  SerialNumber=DCA3901746FF

This is an el-cheapo external USB-Sata case with an Western Digital WDC-WD50? (model 00AAKS) 500Gb SATA-II drive in it. It spins down perfectly with sdparm and spins-up when accessed.

  • 30 Jan 2009

Buffalo TurboUSB DriveStation 1TB. Spin down works with sdparm.

  • 03 Jan 2009
P:  Vendor=1e68 ProdID=001b Rev= 0.00
S:  Manufacturer=JMicron
S:  Product= DS maxi g.u
S:  SerialNumber=200810211D18

This is a "TrekStor? DataStation? maxi g.u" (external case comes with harddisk installed). The disk size is 1 TB. If someone tells me how to find out the model of the disk, I will post it. (Cannot open case -- warranty loss.) Works perfectly with scsi-stop /dev/sdX, and also "Spindown daemon without kernel patch for Unslung by Vladimir" (see above). I also have the 500 GB version of this device, same results.

  • 27 Sep 2008
P:  Vendor=0c0b ProdID=b159 Rev= 1.03
S:  Manufacturer=Trekstor
S:  Product=DataStation maxi m.u
S:  SerialNumber=00DEBB3a

sg_start works

  • 21 Feb 2008 by Rutger
P:  Vendor=067b ProdID=2506 Rev= 1.00
S:  Manufacturer=Prolific Technology Inc.
S:  Product=Mass Storage Device
S:  SerialNumber=0
Holding a WDC WD25  Model: 00AAJB-00WGA0 Rev: 00.0 in an eMagic USB2/IDE housing
sdparm --command=stop /dev/sdX works perfect
  • 18 Feb 2008 by `Impaler:

Thermaltake MAX 4 N0003US - Same chipset as the ICY BOX described underneath; worked just fine with sdparm from NSLU2. HDD used was a Samsung HD501LJ

  • 12 Jan 2008: No-Name / Myson Century, Inc (board: uf-3501). Seems to offer a Prolific PL3507?. Drive spinsdown with 'sg_start 0 --pc=3 /dev/sdd'
P: Vendor ID=04cf Product ID=8818 Revision=b0.07
 S:  Manufacturer=Myson Century, Inc.
 S:  Product=USB Mass Storage Device
 S:  Serialnumber=100
P:  Vendor=04fc ProdID=0c15 Rev=ec.02
 S:  Manufacturer=Sunplus Technology Inc.
 S:  Product=USB to Serial-ATA bridge
 S:  SerialNumber=ST3750640A

Works using sdparm --command=stop on slugOS 4.8 beta

system: Linux Marius #1 PREEMPT Mon Dec 24 23:12:24 UTC 2007 armv5teb unknown
 P:   Vendor=04fc ProdID=0c15 Rev=c5.bd
 S:  Manufacturer=Sunplus Technology Inc.
 S:  Product=USB to Serial-ATA bridge
 S:  SerialNumber=WDC WD5000     WD-WMAPW1137424

* 22 Aug 2007 [[http://www.maxtorsolutions.com/en/catalog/Basics_Basic/ |Maxtor Basics 3200]] works with sdparm.
[@P:  Vendor=0d49 ProdID=3200 Rev=0.01
 S:  Manufacturer=Maxtor Corporation
 S:  Product=Maxtor 3200
 S:  SerialNumber=2CAHGKE3x
  • 22 Aug 2007 Vantec NexStar-3 PATA to USB works using sg_start 0 --pc=2 holding a Seagate 320 gig drive. This housing apparently uses the same chipset as the Evertech device.
P:product: USB2.0 Storage Device
vendor: Cypress Semiconductor
physical id: 4
bus info: usb@4:4
logical name: scsi30
version: 0.01
serial: DEF1065D483E
capabilities: usb-2.00 scsi emulated scsi-host
configuration: driver=usb-storage maxpower=0mA speed=480.0MB/s
  • 30 May 2007: Raidsonic IB-360UE-BL, does feature an Agere chip (FW8028) on the exposed side of the circuit board, but this appears to be the Firewire interface circuit. Hard drive spins down with scsi-stop - not tried any other method.
P:  Vendor=067b ProdID=3507 Rev= 0.01
S:  Manufacturer=Prolific Technology Inc.
S:  Product=ATAPI-6 Bridge Controller
 P:  Vendor=067b ProdID=3507 Rev= 0.01
 S:  Product=ATAPI-6 Bridge Controller
 S:  Manufacturer=Prolific Technology Inc.
 Chip: not visible, assuming(!) Profilic PL3507
  • 9 Mar 2007: Sharkoon Swift-Case 3.5" USB 2.0 which seems to have a Cypress 68300B/C chipset does work. Drive spinsdown with '/usr/bin/sg_start 0 --pc=2 /dev/sdb'
  • 7 Mar 2007: Looks like any device with a Prolific PL-3507 chipset will work. I just got a cheap no-name USB/Firewire enclosure from eBay, and 'sdparm --command=stop /dev/sda' worked instantly! Can someone confirm that the PL-3507 chipset always works?
  • Raidsonic IB-351UE-B also works (spins down using scsci-stop on SlugOS). Can't find 'prolific' anywhere on the chip but the raidsonic faq says the case also contains a prolific chip.
  • PPA ME-780U2-2162, which also uses a Prolific chipset.
  • 5 April 2007: ID 04fc:0c15 Sunplus Technology Co., Ltd - Welland, Sun Bright enclosure seems to work fine: http://www.welland.com.tw

There is a list of chipsets used in various Raidsonic enclosures.

  • 14 April 2007: ID 09CC:2106, AMS Venus T4U 4-disk enclosure; works with sg_start --stop to the appropriate disk. Tested with a Seagate ST3750640A (primary master) and a Western Digital WD1000BB (secondary master), configured to run independently. Each drive spins down on command.
  • Iomega Hi-Speed USB 2.0 Desktop Hard Drive (250 Gbyte) uses the Prolific PL-2507 chipset and supports start/stop nicely. (Power consumption active 9W, standby 2W).
P:  Vendor=067b ProdID=2507 Rev= 0.00
S:  Manufacturer=Prolific
S:  Product=PL-2507 USB Storage Device
S:  SerialNumber=0620000022C5
Every Disk with a PL2507 should support spindown via scsi command with at least sg_start --stop 
  • Not USB, but anyway, Buffalo DriveStation Duo 1TB (HDW10TIU2R1 - Bought in Japan). Using 1394 connection and Raid 1 config. Spin down works with sg3-utils.
  • NOVAC NV-US2000 USB-SATA converter. Works with sg3-utils.

P: Vendor=152d ProdID=2338 Rev= 0.00 S: Manufacturer=NOVAC S: Product=NOVAC NV-US2000

  • Western Digital - Elements 500GB
P:  Vendor=1058 ProdID=1001 Rev= 1.06
S:  Manufacturer=Western Digital
S:  Product=External HDD

Actually has a built-in spindown feature, which /should/ spindown the drive afer 10min idle time, but this worked on my OpenSlug/BE only very few times. Drive immedialty reacts to scsi-stop or 'sdparm --command=stop /dev/sdX' and wakes up automatically.

 P:  Vendor=04b4 ProdID=6830 Rev= 0.01
S:  Manufacturer=Cypress Semiconductor
S:  Product=USB2.0 Storage Device
S:  SerialNumber=DEF106207355

Works with 'sg_start 0 --pc=2', but not with sdparm.

  • Trifoo IDE to USB Adapter Cable (stops with sdparm command)
P:  Vendor=067b ProdID=2506 Rev= 1.00
S:  Manufacturer=Prolific Technology Inc.
S:  Product=Mass Storage Device
S:  SerialNumber=0
  • LaCie 500 designed by Porsche when it is using a SEAGATE ST3500830A. It doesn't work when it comes with a Samsung HD501LJ.
    edit: it doesn't work for my LaCie 500 with SEAGATE ST3500830A, either with sdparm or sg_start. No reaction...
  • Seagate FreeAgent 160 GB (2.5')

4 March 2008

  • Evertech enclosure for 2,5" disks


S:  Manufacturer=Prolific Technology Inc.
Chip: Prolific PL-2506<

works well with hd-idle.

28 August 2008

P:  Vendor=0471 ProdID=200e Rev= 1.00
S:  Manufacturer=Philips
S:  Product=Philips Harddisk

works well with hd-idle

DIGITUS 3.5" external HDD enclosure SATA to eSATA / USB 2.0 DA-70580

P:  Vendor=152d ProdID=2336 Rev= 1.00
S:  Manufacturer=JMicron
S:  Product=JM20336 SATA, USB Combo

Although this one has a JMicron? chipset (see below), this one spins down perfectly, at least with a Hitachi HDP725050GLA360? 500G SATA disk.

Adapters which do NOT support start/stop

20 April 2011 lsusb says: ID 14cd:6600 Super Top USB 2.0 IDE [IC Moai M110E?]

P:  Vendor=14cd ProdID=6600
S:  Manufacturer=Super Top?
S:  Product=Moai PATA, USB Combo

Bought in e-Bay (2rd try). Was not able to stop with dhparm - should check with sdparm.

30 October 2008

P:  Vendor=152d ProdID=2336 Rev= 1.00
S:  Manufacturer=JMicron
S:  Product=JM20336 SATA, USB Combo

Appears that JMicron? chip doesn't support stop/start. See above for an Digitus enclosure with a JMicron? chipset that does.

  • Evertech
 P:  Vendor=04b4 ProdID=6830 Rev= 2.40
 S:  Product=Cypress AT2LP
 Chip: CY7C68300B-56PVXC
  • Delock Combo
 P:  Vendor=0402 ProdID=5621 Rev= 1.03
 S:  Product=USB 2.0 Storage Device
 Chip: ALI M5621 + Oxford FW
  • atechweb LAN Server HD9-U2lA (Not supporting "stop" via USB but "inside")
 P:  Vendor=05e3 ProdID=0702 Rev= 0.33
 S:  Product=USB TO IDE
 Chip: GL811E (FTR: CPU: RDC R2882)
  • Raidsonic Icy Box IB-351UE - Agere Chip
  • LCPower EH35B-SII
 P:  Vendor=152d ProdID=2336 Rev= 1.00
 S:  Manufacturer=JMicron
 S:  Product=JM20336 SATA, USB Combo
  • Black Cyclone 3.5" Portable Gard Disk Drive MDT-SI3572 (and possibly other models: MDT-U3572, MDT-US3572, MDT-US3572II, MDT-UFS3572, MDT-UF3572)
 P:   Vendor=0x152d ProdId=2338 Rev= 1.00
 S: Manufacturer=JMicron
 S: Product=USB to ATA/ATAPI Bridge
  • 2007/05/13: tried "sdparm --command=stop /dev/sdX", showed no error but didn't do anything (disk kept spinning). Ditto, "/usr/bin/sg_start 0 --pc=2 /dev/sdX"; ditto, ALL values from 0 to f for "pc=".
  • 2007/06/3: Same tried on unlabeled USB to SATA/PATA adapter bough in Japan that reports the same USB IDs from JMicron. No success stopping the drive.
  • LaCie 500 designed by Porsche, when this enclosure is using a Samsung HD501LJ. It works fine when it is using a SEAGATE ST3500830A
  • Fantec LD-U35US
P:  Vendor=152d ProdID=2338 Rev= 1.00
S:  Manufacturer=OTB-HDD-NT68320
S:  Product=USB Mass Storage
  • 2007/12/27: found no way to power down any IDE disk in this enclosure. Tried Maxtor, Quantum and Seagate with sg_start, sdparm and hd-idle (all of these three commands work with my other USB disk). The adapter also supports SATA drives but I didn't have one for testing.
  • VanTec CB-ISATAU2
P:  Vendor=152d ProdID=2338 Rev= 1.00
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge
  • 2008/04/01: Could not spin down a variety of drives with "sdparm --command=stop".
  • [name??]
P:  Vendor=152d ProdID=2339 
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge

found in a 2.5" USB to SATA enclosure. only supports SATA disks.

  • 2008/01/29: no way to power down the disk (Hitachi HTS541640J9SA00); tried sdparm and other methods, always got an error message.


  • TEAC HD-15PUK-B-200
P:  Vendor=152d ProdID=2339 Rev= 1.00
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge
  • 2008/02/19: This nice looking external USB drive does not support any of the presented methods for spinning down.

4 March 2008

S:  Manufacturer=Moai Electronics Corp.
Chip: Moai M110E.

Looks nice but does not support any of the methods mentioned above, despite of the fact that the chip has a suspend state itself, regarding or not regarding the state of the disk...

7 March 2008

  • Icy Box IB-351U with
P:  Vendor=04b4 ProdID=6830 Rev= 0.01
S:  Manufacturer=Cypress Semiconductor
S:  Product=USB2.0 Storage Device
  • With "Maxtor 7 L250R0". Tried hdparm, sdparm, sg_start

22 August 2008

  • Icy Box IB-351AStU-B
P:  Vendor=152d ProdID=2338 Rev= 1.0
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge
  • Neither sdparm nor sg_start works.

This page is password protected.

The password is "spindown". Let's see if that stops the automated wiki spam.

view · edit · print · history · Last edited by AI.
Based on work by AI, Mark Vertesaljai, soapm, MoD, axl, Adam Flippo, JNC, P van Voorst, ObiYawn, JonH, EB, Hendrik, sdub, Michael, macnet, florin, fedor, A Hagge, ciVic, bitbucket, Marco, klinker, Fnord, JonBoy, fcarolo, sluggy, MicRo, Karl, TheRookie, njr, craigpratt, emmis, japping, espen at gyfgafgufdk, tw, heinrichh, Rutger, BenMcDui, Florian Bomers, Vlad Petric, pascal, marc, jj goessens, Jonathan Cohen, PaulBrandt, KenP, frapex, Simula77, anonymous, asys3, Mangusta, vivekv, BoehserWolf, stripwax, db353, stu, jiml8, jcunwin, christian, Silvestre Zabala, marceln, Casimodo, Terje, yhoo_does_my_head_in, Tom Vandepoel, DurvalMenezes, Bjorn, muanis, Christian Mueller, Vladimir, dfsmith, Scott Alfter, Pseudo, ST, fatbag, EKI, izeman, Vegard HB, mk, Peter Taylor, Joop Verdoorn, jjh, Richard, landeshauptbill, Anguel Stankov, nschum, chacko, Maik, dA, Tobbe, Patrik Weiskircher pat at icore dot at, marcusb, rwhitby, Hillary, mathieu_xwave, cialis, free ringtones, tenfoot, christmas cards, bathroom vanities, wholesale handbags, argh, Xavier, verizon ringtones, rolex replica, handbags, replica rolex, PatrickvdP, donotdespisethesnake, buy cialis, Matt Brubeck, christmas gifts, Steve G, hexanen, Christmas gifts, prom dresses, Mike, chanel handbags, leromarinvit, halloween costumes, nicoatyow, free nokia ringtones, baeksu, buy viagra, mag, replica watches, Phil Endecott, yaasel, hgfjf5, Helga, Poutnik, Eddie, rchristian at gmxde, dfgdgaw, dbpalan at hotmail dooot com, dsafsfd, Christian Hall, peter taylor, Unhinged, furiouslettuce, emm_is, if, phil endecott, aj, Ken Pizzini, rz, Dave Hooper, Lurch, jon, Miro Dietiker, Chris, Doug Knabe, Ruud Senden, tman, Fred Wenzel, Zhyla, Rainer, Ramiro, slavikb, Patrick Stewart, and ingeba.
Originally by tman.
Page last modified on October 21, 2012, at 09:06 AM