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
  • 70,465
daltonfury42
  • 5,499
  • 4
  • 1
    Remove the drive from fstab, shut down the machine completely, remove the drive physically and start the machine. Then do a blkid and [edit] your answer and post that output. Then insert the drive and do another blkid and [edit] and post that output as well... Then post a comment @fabby – Fabby Jun 27 '15 at 20:54
  • @Fabby, I had to struggle to put the HDD in the optical bay. I don't feel like removing and inserting it again. Do you still insist on doing this? Why? – daltonfury42 Jun 27 '15 at 21:07
  • Erm, sorry! I meant: Unplug the optical bay, instead of unscrewing the HDD! ;-) What I'm trying to see is whether by hot-(un)plugging we can get it to work. Which would mean a combined hardware/software solution might get you what you want... >:-) – Fabby Jun 27 '15 at 22:04
  • 3
    Where it is physically plugged in doesn't matter, you are still asking how to get a HDD to spin down to save power. – psusi Jun 27 '15 at 22:51

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,955
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