Other Turn hard drives on and off?

I think I asked this in the past and am wondering if anything has changed. Is it possible to completely power down a standard SATA hard drive though software? I want to have massive storage of dozens of drives but only one or two drives needs to be on at any moment. Otherwise I am shuffling USB hard drives. What about a USB hub that you can turn ports on and off?
 
It is, BUT, a complete software power down will require you to reset the hard drive(s). That means, switching off then on to restore.
You would need to dismount them before this, ensuring no open file(s).

You can make drives spin down into an idle state. It depends on your drive's abilities.

You may wish to read this:
 
For SATA and SAS, the answer is vendor- and model dependent. Yes, there are mode pages you can set that prevent a drive from spinning up when power comes on. Yes, you can spin-up and spin-down drives under computer control. To do that, you probably need to download the specific SATA or SAS interface manuals for the drives you are using. This functionality is supported for enterprise drives, but using it may require working with engineering groups from the drive vendor, you may have to get special firmware to enable full power control (which is pretty much only possible if you are a large customer, who buys drives by the thousand or by the million). A better option is to control power to the drive, see below.

Be aware that the power consumption of a drive will not go down to zero when it receives power and is in internal power-saving modes, and that drives typically have multiple power modes, with different power usage. The documentation will tell you. Ultimately, for typical workloads, you'll end up saving surprisingly little power.

For consumer drives, I hear stories of drives ignoring these settings. That's because consumers need to be protected from themselves: people play with their disks, they think they have a dead disk, they get mad at the manufacturer or waste the time of the manufacturers or sellers tech support people, when in reality all that happened is that they told the drive to spin down and not spin up any more.

Real-world applications of this technology at scale typically don't rely on the drive itself, but they put switching components (relays, transistors in the power distribution) into the drive backplane in the enclosure. Typically those switching components are then controlled by an enclosure controller (which in the real world is typically a SAS expander, doing double duty as a SES enclosure controller). I guess one could fake this with a Raspberry Pi and a handful of small relays, and a few hours of soldering. I've never heard of a USB hub that allows controlling the USB power lines, if your disks are USB powered, but such a thing might exist.

Beware that powering drives up and down tends to stress the storage software stack out a little bit, in particular if you do it while IO is running. A real-world implementation will need to coordinate this with the software stack, to make sure errors are handled correctly, and to make sure all the ancillary operations (such as mounting/dismounting file systems, running scrub, keeping track of disk availability and health) are orchestrated correctly. And also note that power-cycling drives can be a very good way to get misbehaving drives back to work; this often uses the same power control hardware that you intend to use.

The idea of spinning down disks to save power is old, and even has its own acronym: MAID, for "massive arrays of idle disks". The idea was not so much about power saving, but about being able to pack disks much more densely: if only a small fraction of the drives (and ancillary hardware, such as controllers and power converters) are on at any given moment, you don't have to allow for very much space for cooling, and you can make the power supply and cooling hardware much smaller and cheaper. This sounds like a great idea ... until you try it, and everything blows up on you. A lot of money was invested by venture capitalists into this idea in the mid-to-late 2000s, and the market leader (ha ha, there never was a market) Copan went under to great fanfare. The whole thing had been founded by a computer scientist from a university, and they suffered from "inhaling their own exhaust": they believed the stories their marketing people told them, that there was a great big need for such arrays. In reality, the rapidly increasing capacity of stock drives ate the opportunity. Furthermore, it turns out that disk drives really hate being power cycled all the time, and disk reliability went to hell. And finally, controlling everything in the software stack above the drives was way too big a task.

If you really want to do this and make it work reliably, you should expect to spent man-years on the engineering. Many man-years. Copan I think went through about $100M in funding before going under.
 
I used to use these scripts for powering on/off an external Samsung SSD in a USB case that I used for backups only:

Code:
#!/bin/sh
/usr/sbin/usbconfig -d `/usr/sbin/usbconfig list | grep 0x1f75 | cut -f1 -d":"` power_on

Code:
#!/bin/sh
/usr/sbin/usbconfig -d `/usr/sbin/usbconfig list | grep 0x1f75 | cut -f1 -d":"` power_off

Never had a problem (I think 0x1f75 was the product id).
 
I unmount the drives and use camcontrol standby da5 to turn off the spindle on HDDs and camcontrol idle da5 to spin it back up. If you're talking about USB or SSDs, I would be amazed if there was some way to manually make them use less power.
 
I’ve got a SATA bay that I use for backup purposes. When I insert a HDD and close the bay’s door, it powers up automatically. When I’m done with the backup, I use camcontrol standby to power down the drive. I wait until it has stopped completely, then open the door, remove the HDD and store it in a safe place.

See the camcontrol(8) manual page for more information.
 
I have an external 3TB Seagate drive that used to be used for a macOS Time Machine. This is the script I use to power up, mount, do backups, unmount and power down.

Code:
# Power up and mount external Seagate disk
usbconfig -d 3.4 power_on && sleep 30 && mount /mnt

# Do backups
...

# Unmount and power down external Seagate disk
umount -v /mnt && sleep 60 && usbconfig -d 3.4 power_off

This has been working well for a year via a cron job :)
 
Back
Top