5

Our backup script mounts an USB hard drive, copies some files, then unmounts. So, since the drive is only in use during this period, I thought it would be good to power down the drive once the backup is complete. Is there a command to do this? If yes, would I need to manually power it back up again when I need to use it next time?

6
  • What type of USB drive? I know most of the Western Digital Mybooks will spin down the drive after inactivity. Some of the better USB docks do this as well.
    – Zoredache
    Oct 27, 2010 at 21:39
  • It's just a generic drive "toaster". Oct 27, 2010 at 21:40
  • 2
    Just an update, I managed to get the drive to stop briefly by running sg_start --stop /dev/sdc but unfortunately the damn thing just starts it's self back up again! Oct 27, 2010 at 21:43
  • 6
    Do you have HAL or udisks on your system? If so, it may be a polling daemon that is waking it back up again. If so, hal-disable-polling --device /dev/sdc or udisks --inhibit-polling /dev/sdc may help.
    – ephemient
    Oct 27, 2010 at 23:19
  • 1
    If your usb drive has has a plug for its electricity, you could plug that in a time switch (en.wikipedia.org/wiki/Time_switch). Then you could program the time switch to turn itself off and on at the times you choose. Oct 29, 2010 at 9:07

2 Answers 2

1

Use this script.

This script is designed to properly put an USB device into suspend mode that can then be unplugged safely. But the ultimate effect is what you want to achieve.

Find some discussion about the similar topic here.

0

I've never seen a USB hard drive that manages power anywhere other than a power switch or the cord itself.

If it were a NAS it may be possible to send commands to the underlying OS to shut it down (or suspend) and possibly send it WakeOnLan commands.

4
  • 2
    Are you sure hdparm won't help? Or maybe sg_start? Oct 27, 2010 at 21:34
  • I'm not sure what you're asking @nbolton? Are you asking if I've tried them, or if I know how to bend those apps to do what you're trying to do, or something else?
    – gWaldo
    Oct 28, 2010 at 12:26
  • if you've tried them id guess, i thought hdparm could do this myself.
    – Sirex
    Jun 17, 2011 at 12:17
  • I've successfully set the spin down time of a wd usb drive with hdparm and now it stops when I'm not using it.
    – Jure1873
    Sep 20, 2011 at 16:44

Not the answer you're looking for? Browse other questions tagged .