Skip to contentSkip to conversation

prevent disk from spinning up at system resume

DISCUSSION Peter Münster 2 participants 6 messages Mar 23, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

My SATA disk (sdb) spins up at every system resume. How could I avoid that please?

Some details:

- sdb not mounted
- echo 0 >/sys/block/sdb/device/scsi_disk/2:0:0:0/manage_start_stop
- hdparm -C /dev/sdb : "drive state is: standby"
- s2ram
- after wake up: "drive state is: active/idle"
- kernel message at wakeup: "sd 2:0:0:0: [sdb] Synchronizing SCSI cache"
- when doing "echo scsi remove-single-device 2 0 0 0 >/proc/scsi/scsi" before s2ram, sdb keeps sleeping after resume

I need the disk only about once per week. I use s2ram several times per day, and I prefer that sdb keeps sleeping.

TIA for any hints,

Signature · 1 line
           Peter
#1 lore raw
Quoted 7 lines · Peter Münster

Hi,

My SATA disk (sdb) spins up at every system resume. How could I avoid that please?

Some details:

Quoted 8 lines

- sdb not mounted
- echo 0 >/sys/block/sdb/device/scsi_disk/2:0:0:0/manage_start_stop
- hdparm -C /dev/sdb : "drive state is: standby"
- s2ram
- after wake up: "drive state is: active/idle"
- kernel message at wakeup: "sd 2:0:0:0: [sdb] Synchronizing SCSI cache"
- when doing "echo scsi remove-single-device 2 0 0 0 >/proc/scsi/scsi" before s2ram, sdb keeps sleeping after resume

It looks like you already have your answer.

Quoted 4 lines

I need the disk only about once per week. I use s2ram several times per day, and I prefer that sdb keeps sleeping.

TIA for any hints,

Alan Stern

#2 lore raw
Quoted 4 lines · Alan Stern
Quoted 2 lines

- when doing "echo scsi remove-single-device 2 0 0 0 >/proc/scsi/scsi" before s2ram, sdb keeps sleeping after resume

It looks like you already have your answer.

Sorry, I forgot to mention, that the disk needs to be mounted. I just wanted to point out, that the kernel wakes up the disk, and not the bios or something else.

Signature · 1 line
           Peter
#3 lore raw
Quoted 8 lines · Peter Münster
Quoted 4 lines · Alan Stern
Quoted 2 lines

- when doing "echo scsi remove-single-device 2 0 0 0 >/proc/scsi/scsi" before s2ram, sdb keeps sleeping after resume

It looks like you already have your answer.

Sorry, I forgot to mention, that the disk needs to be mounted.

Why does the disk need to be mounted if you aren't using it more than once a week or so? Why not mount it only while it is in use?

Quoted 2 lines

I just wanted to point out, that the kernel wakes up the disk, and not the bios or something else.

The kernel wakes up _every_ device during system resume, even ones that were in runtime suspend when the system suspend started. With only a few exceptions, there is no way around this in the current kernel.

Alan Stern

#4 lore raw
Quoted 2 lines · Alan Stern

Why does the disk need to be mounted if you aren't using it more than once a week or so? Why not mount it only while it is in use?

The workflow would be quite different:
normal workflow:
- application needs file on sdb
- sdb spins up
- application can open the file

workflow with unmounted sdb:
- application needs file on sdb
- error message: no such file (or similar)
- user sees error message: "oh dear, the file is on sdb..."
- superuser needs to "add-single-device" and mount it
- user can continue with application

Quoted 3 lines

The kernel wakes up _every_ device during system resume, even ones that were in runtime suspend when the system suspend started. With only a few exceptions, there is no way around this in the current kernel.

Even after "echo 0 >/sys/block/sdb/device/scsi_disk/2:0:0:0/manage_start_stop" ?

If there wasn't the "Synchronizing SCSI cache" at system resume, would the disk spin up nevertheless?

Signature · 1 line
           Peter
#5 lore raw
Quoted 5 lines · Peter Münster
Quoted 3 lines

The kernel wakes up _every_ device during system resume, even ones that were in runtime suspend when the system suspend started. With only a few exceptions, there is no way around this in the current kernel.

Even after "echo 0 >/sys/block/sdb/device/scsi_disk/2:0:0:0/manage_start_stop" ?

Yes. As I understand it, writing 0 to manage_start_stop prevents the kernel from sending a spin-up or spin-down command to the drive. But SATA drives automatically spin up anyway when the port returns to full power. Removing the SCSI device entry probably prevents the system from changing the port's power level.

(Some of the details may be wrong here, because I'm not very familiar with how the ATA subsystem works.)

Quoted 2 lines

If there wasn't the "Synchronizing SCSI cache" at system resume, would the disk spin up nevertheless?

Yes, I think so. In fact, the cache gets synchronized at system suspend, not at system resume. But the message doesn't get written to the log file until after the system is running again.

Alan Stern