Giter VIP home page Giter VIP logo

Comments (7)

adelolmo avatar adelolmo commented on September 26, 2024 1

Hi @jk-1

Checking for disk activity state is completely out of the scope of this tool.

I'd suggest to take a look to SCSI response not ok as an starting point to fix the issue with sudo hdparm -C /dev/sdb.

If you are already using hd-idle, you can always check disks' spin changes in system log:

$ grep hd-idle /var/log/syslog
Dec  4 00:00:34 enterprise hd-idle[30189]: sda spinup
Dec  4 00:00:34 enterprise hd-idle[30189]: sdc spinup
Dec  4 00:00:34 enterprise hd-idle[30189]: sdb spinup
Dec  4 00:15:34 enterprise hd-idle[30189]: /dev/sdb spindown
Dec  4 00:16:35 enterprise hd-idle[30189]: /dev/sda spindown
Dec  4 00:16:35 enterprise hd-idle[30189]: /dev/sdc spindown
Dec  4 09:30:39 enterprise hd-idle[30189]: sda spinup
Dec  4 09:31:39 enterprise hd-idle[30189]: sdc spinup
Dec  4 09:41:39 enterprise hd-idle[30189]: /dev/sda spindown
Dec  4 09:41:39 enterprise hd-idle[30189]: /dev/sdc spindown
Dec  4 12:00:42 enterprise hd-idle[30189]: sda spinup
Dec  4 12:00:42 enterprise hd-idle[30189]: sdc spinup
Dec  4 12:16:42 enterprise hd-idle[30189]: /dev/sda spindown
Dec  4 12:16:42 enterprise hd-idle[30189]: /dev/sdc spindown
Dec  4 13:06:45 enterprise hd-idle[30189]: sdc spinup
Dec  4 13:16:45 enterprise hd-idle[30189]: /dev/sdc spindown
Dec  4 13:22:48 enterprise hd-idle[30189]: sda spinup
Dec  4 13:22:48 enterprise hd-idle[30189]: sdc spinup
Dec  4 13:22:48 enterprise hd-idle[30189]: sdb spinup
Dec  4 13:33:48 enterprise hd-idle[30189]: /dev/sda spindown
Dec  4 13:33:48 enterprise hd-idle[30189]: /dev/sdc spindown
Dec  4 13:33:51 enterprise hd-idle[30189]: /dev/sdb spindown

You can know the state of any disk by checking the latest state change in the log. In the example above sda, sdb and sdc are all spun down.

from hd-idle.

cannondale0815 avatar cannondale0815 commented on September 26, 2024

A good, non-intrusive way to query the spindown state with smartctl is as follows:

sudo smartctl -i -n standby /dev/sdc | grep "ACTIVE\|STANDBY" | awk '{print $4}'

The above either returns "ACTIVE" or "STANDBY".

The "-n" option is essentially preventing the drive from spinning back up if it's in standby mode. The built-in help says:

-n MODE[,STATUS], --nocheck=MODE[,STATUS] No check if: never, sleep, standby, idle (see man page)

from hd-idle.

auanasgheps avatar auanasgheps commented on September 26, 2024

Hi @jk-1

Checking for disk activity state is completely out of the scope of this tool.

I'd suggest to take a look to SCSI response not ok as an starting point to fix the issue with sudo hdparm -C /dev/sdb.

If you are already using hd-idle, you can always check disks' spin changes in system log:

$ grep hd-idle /var/log/syslog

Why saved logs only show when disks are spun up and not also when they're down like the command above? Would be possible to get this?

from hd-idle.

jk-1 avatar jk-1 commented on September 26, 2024

A good, non-intrusive way to query the spindown state with smartctl is as follows:

sudo smartctl -i -n standby /dev/sdc | grep "ACTIVE\|STANDBY" | awk '{print $4}'

The above either returns "ACTIVE" or "STANDBY".

The "-n" option is essentially preventing the drive from spinning back up if it's in standby mode. The built-in help says:

-n MODE[,STATUS], --nocheck=MODE[,STATUS] No check if: never, sleep, standby, idle (see man page)

For some reason this does not work. I have tried several modes but the disk spins up, before the result is displayed.
E.g

sudo smartctl -i -n sleep,0 /dev/sdb
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-56-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Device is in SLEEP mode, exit(0)
sudo smartctl -i -n standby,2 /dev/sdb
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-56-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Device is in SLEEP mode, exit(2)

Before the last row is displayed, disk is spinning again. I have tested this only with WD My Book USB3 disks. They contain WD red disk.

I also tried with different STATUS values (0,2) and without STATUS value without any difference to result.

from hd-idle.

jk-1 avatar jk-1 commented on September 26, 2024

Checking for disk activity state is completely out of the scope of this tool.

I'd suggest to take a look to SCSI response not ok as an starting point to fix the issue with sudo hdparm -C /dev/sdb.

Hi adelolmo,

Thank you for the tip: https://github.com/adelolmo/hd-idle/wiki/SCSI-response-not-ok

I tried that:

lsusb
Bus 002 Device 003: ID 1058:25ee Western Digital Technologies, Inc. My Book 25EE
...

and then

cat /sys/module/usb_storage/parameters/quirks
1058:25ee:u

Then plug out and plug in the disk. Unfortunately hdparm still cannot get the disk state.

sudo hdparm -C /dev/sdb1

/dev/sdb1:
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 00 81 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 drive state is:  unknown

from hd-idle.

adelolmo avatar adelolmo commented on September 26, 2024

Hi @jk-1
Checking for disk activity state is completely out of the scope of this tool.
I'd suggest to take a look to SCSI response not ok as an starting point to fix the issue with sudo hdparm -C /dev/sdb.
If you are already using hd-idle, you can always check disks' spin changes in system log:

$ grep hd-idle /var/log/syslog

Why saved logs only show when disks are spun up and not also when they're down like the command above? Would be possible to get this?

Please check the documentation to understand how the logs.

from hd-idle.

adelolmo avatar adelolmo commented on September 26, 2024

@jk-1

I won't be able to give you any support on tools like hdparm or smartctl.
You should try asking on their project sites: https://sourceforge.net/projects/hdparm/ and https://github.com/mirror/smartmontools

I'm closing this issue, but feel free to keep the conversation active if you need to.

from hd-idle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.