0

How to send to sleep a hard drive completely after it's being unmounted?

I'm planning to have separate 4TB drive only for backups. It will be encrypted and I will only mount it when I need to perform big backups. After unmounting it again, I would like to send it to sleep, i.e. physically to make it stop spinning.

Is there a way to do it in CentOS Linux 6.3?

Any help would be appreciated.

Ilia
  • 1,004
  • 1
  • 10
  • 19
  • The title of the above post was different enough to throw me off, but it answers the same question. – Hennes Mar 02 '13 at 17:34
  • Sorry, but I was really trying to find the answer - the titles are not really clear on the previous posts. I couldn't find it! – Ilia Mar 02 '13 at 18:09
  • 1
    I did not find it either, despite looking. Only after I went back with a 'this must have been asked before' attitude I found the other post. – Hennes Mar 02 '13 at 18:30

1 Answers1

2

You can do that by sending the drive a command via hdparm. Either by sending it a direct command to go to sleep (-y or -Y), or by setting the timeout for the drive to do this on its own.

The relevant commands for that are:

  • hdparm -S180 /dev/hdc (Enter standby mode on its own after a multiple of 5 seconds. Valid values are [1..240]
  • -y Immediately enter low power consumption standby mode, usually causing it to spin down.
  • -Y Immediately enter the lowest power consumption sleep mode, causing it to shut down completely. A hard reset or soft reset is required before the drive can be accessed again.
Hennes
  • 4,772
  • 1
  • 18
  • 29
  • thank you! Is there a way not to restart the server to take it out of standby mode? Once you try to load 'mount' command and refer to this standby-ed drive, then it would automatically started spinning again? – Ilia Mar 02 '13 at 17:36
  • 1
    Using -y (small letter, not the capital Y) should allow that. It is the difference between standby and sleep. In standby the disk should be useable, though it make take a while to spin back up. So your mount command may seem to hang for about half a minute. – Hennes Mar 02 '13 at 17:41