You are not logged in.

#1 2014-11-01 16:26:08

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

How to put HDD permanently to sleep (also after resuming)?

I've got a HDD in my laptop which I want to put permanently to sleep as I intend to use it only very seldomly (e.g. for a backup once a day).

I managed to disable the drive on startup by the means of this thread, i.e. I use the following service file:

[Unit]
Description=Put HDD to sleep mode immediately

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/hdparm -Y /dev/disk/by-id/ata-ST500LM000-SSHD-8GB_W761GARW

[Install]
WantedBy=basic.target

However after resuming my laptop from suspend (to RAM) the drive is enabled again -- but I want it to stay in sleep mode.

Currently I use TLP for power management. Regarding to the management of hard disks I've set In /etc/default/tlp:

DISK_DEVICES=""

Alas this doesn't seem to make any difference: The drive is spinning when resuming the laptop.

Any hints?

Last edited by ball (2014-11-01 17:43:31)

Offline

#2 2014-11-06 21:03:29

float
Member
Registered: 2012-10-05
Posts: 23

Re: How to put HDD permanently to sleep (also after resuming)?

You could create a similar systemd service that puts the drive to sleep mode triggered by the resume target by adding something like After=resume.target.
But that would not prevent the drive from spinning up right after resuming, I guess.
It will just go to sleep immediately after systemd calls hdparm.

Offline

#3 2014-11-06 21:19:24

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: How to put HDD permanently to sleep (also after resuming)?

Thanks for your input. But yeah, the drive will spin up nevertheless.

Offline

#4 2015-02-10 09:07:49

Retr0spectrum
Member
Registered: 2015-02-10
Posts: 7

Re: How to put HDD permanently to sleep (also after resuming)?

Did you ever find a proper solution? I am having exactly the same problem.

Offline

#5 2015-02-10 09:18:08

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: How to put HDD permanently to sleep (also after resuming)?

No.  But replacing the HDD with a SSD seems like a viable solution to me...

Offline

#6 2015-02-10 15:04:02

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: How to put HDD permanently to sleep (also after resuming)?

This is moot anyway. Carrying your backup data in the same container (or just in the same room) as your primary data at all times is a very bad idea:

"Crap, my laptop got stolen. At least I have backups. Oh, wait..."
"Crap, I dropped my laptop and the disk is messed up. At least I have backups. Oh, wait..."
"Crap, the power lines outside my house were hit during a thunderstorm and my laptop was fried. At least I have backups. Oh, wait..."

...And so on.

Offline

#7 2015-02-10 17:24:54

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: How to put HDD permanently to sleep (also after resuming)?

Well, that's true.  I do daily backups to external devices, one at home one at school.  Adding another one, which sits in my laptop, doesn't hurt and may be convenient when my computer is not connected to the usual backup devices.  But yeah, your remark is right anyway...

Offline

#8 2015-02-10 17:35:09

frostschutz
Member
Registered: 2013-11-15
Posts: 1,417

Re: How to put HDD permanently to sleep (also after resuming)?

There's a staggered spinup mode for hard drives that makes them stay in standby on power up.

Problem is, as soon as anything tries to detect the disk, it spins up anyway - or worse: if your platform does not support staggered spinup, the drive does not exist until you hook it up elsewhere and undo the setting.

-s     Enable/disable  the power-on in standby feature, if supported by the drive.  VERY DANGEROUS.

Without a hardware switch its almost impossible to prevent the spinup. That's just what drives do, you have to live with it. Of course the issue goes away with SSD (they "spin up" too but no one cares anymore).

Offline

#9 2015-02-10 17:37:49

Retr0spectrum
Member
Registered: 2015-02-10
Posts: 7

Re: How to put HDD permanently to sleep (also after resuming)?

I don't actually use my HDD for backups, I have partitions for Win7, Mint and OSX which I use occasionally. I will probably also use it for storing files that don't fit on my 60GB msata ssd.

I have now installed the TLP package, and set DISK_APM_LEVEL_ON_BAT="1" (probably too low, but fine for testing). This has half-fixed my problem. When my laptop wakes up, the drive spins up and then spins back down again after about 10 seconds. How can I stop it from spinning up in the first place?

Offline

#10 2015-02-10 17:42:18

Retr0spectrum
Member
Registered: 2015-02-10
Posts: 7

Re: How to put HDD permanently to sleep (also after resuming)?

frostschutz wrote:

There's a staggered spinup mode for hard drives that makes them stay in standby on power up.

Problem is, as soon as anything tries to detect the disk, it spins up anyway - or worse: if your platform does not support staggered spinup, the drive does not exist until you hook it up elsewhere and undo the setting.

-s     Enable/disable  the power-on in standby feature, if supported by the drive.  VERY DANGEROUS.

Without a hardware switch its almost impossible to prevent the spinup. That's just what drives do, you have to live with it. Of course the issue goes away with SSD (they "spin up" too but no one cares anymore).

Surely it would be possible to not attempt to detect the disk?

Offline

#11 2015-02-11 17:14:49

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: How to put HDD permanently to sleep (also after resuming)?

Retr0spectrum wrote:

Surely it would be possible to not attempt to detect the disk?

Not necessarily. When it comes to suspend-to-RAM, the OS and the machine work in tandem. The motherboard firmware (BIOS or UEFI) does some of the work. In the case of most machines resuming includes polling the disks when the system resumes from a suspended state to ensure that the physical disks on which filesystems mounted before suspending are still present after resuming. Since the motherboard firmware is dumb, it just checks all available interfaces.

Offline

#12 2015-02-13 20:46:12

Retr0spectrum
Member
Registered: 2015-02-10
Posts: 7

Re: How to put HDD permanently to sleep (also after resuming)?

ANOKNUSA wrote:
Retr0spectrum wrote:

Surely it would be possible to not attempt to detect the disk?

Not necessarily. When it comes to suspend-to-RAM, the OS and the machine work in tandem. The motherboard firmware (BIOS or UEFI) does some of the work. In the case of most machines resuming includes polling the disks when the system resumes from a suspended state to ensure that the physical disks on which filesystems mounted before suspending are still present after resuming. Since the motherboard firmware is dumb, it just checks all available interfaces.

I'm not saying you're wrong, but how come I can reboot without the drive spinning up?

Offline

#13 2015-02-14 17:07:00

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: How to put HDD permanently to sleep (also after resuming)?

I'd guess that the system is just smart enough to know that rebooting and resuming from suspend are different: the system knows when you reboot that no filesystem on that disk is mounted; there's nothing to sync to that drive, and so no reason to spin up the drive. When you resume, there's no way for the system to know whether any hardware has been modified until it checks for it. That check is performed both to ensure system consistency and, in the case of some high-end laptop motherboards, as a security checkpoint to prevent anyone from tampering with system hardware while it's in a suspended state. I guess what I'm saying is that what you want may be possible, but from what I know it seems unlikely without the ability to actually power off the SATA connector itself (usually through the BIOS/UEFI menu).

Offline

Board footer

Powered by FluxBB