2

It is not a duplicate because the HDD in question is plugged into the optical bay.

I have replaced my HDD with an SSD. Then I put the HDD in a optical bay caddy, and put it in place of my CD Drive.

Everything is working fine, except I use the HDD to save bulk data which I won't be using that frequently.

So, is it possible, by any means, to power the HDD off and on in my optical drive, while the system is running? A shell script will do it, perhaps?

Zanna
  • 72,312
daltonfury42
  • 5,559

2 Answers2

3

The SATA connection in the optical drive bay is no different from the other SATA ports. A hard disk drive connected where your DVD drive was will show as a regular SATA drive (ie: as /dev/sdb) and can be put to sleep, using hdparm

To put this drive to sleep after 10 seconds of inactivity and save battery, you could do:

sudo hdparm -S 10 /dev/sdb

This is not permanent and can be configured to be so in /etc/hdparm.conf. See the man hdparm manual pages for more details.

ThunderBird
  • 1,963
  • 13
  • 22
  • 31
istepaniuk
  • 148
  • 8
0

Unfortunately, this is not possible unless the SATA controller on your motherboard has it as a feature. I am not aware of any controllers that expose this in their API. Even if it was available, you would need to get into the Linux kernel's SATA driver and code in your access through a system call (or, even better, a /proc filesystem access). In essence, you would need to hack and recompile your own custom kernel.

You may have a more simple solution through using an USB external hard drive enclosure: just put the platter HD into one of these, and connect only when you need access. You can go with USB 3 if the enclosure handles it and you have a USB 3 port on your computer, which would give you native HD speeds since a platter HD is in fact much slower than USB 3.

This question actually touches on the main distinction between hot-pluggable devices such as USB and not hot-pluggable (or only with supplementary circuitry) such as SATA.

ALAN WARD
  • 542