Giter VIP home page Giter VIP logo

Comments (9)

exodus1984 avatar exodus1984 commented on June 29, 2024 1

Ok - forget about what I said about configuration. It's ok. I just think it could have been done less lengthy.
However, I think that no disk should not close the program. There should be information about it in the log, but the program should not end with an error. It should work all the time.

hd-idle -i 60 -a sdb -i 0 -a sdc -i 0 -a sdd -i 0 -a sde -i 0 -l /var/log/hd-idle.log
symlinkPolicy=0, defaultIdle=60, defaultCommand=scsi, debug=false, devices=[{sdb sdb 0 scsi} {sdc sdc 0 scsi} {sdd sdd 0 scsi} {sde sde 0 scsi}], logFile=/var/log/hd-idle.log
sdf spindown
2019/10/21 09:07:51 open /dev/sdf: no medium found

I started the program from the command line to check whether it really comes out with code 1. And unfortunately this is happening - instead of informing that the disk cannot be put to sleep, the program ends its operation.
In my opinion, this is bad program behavior.

btw - the service behaves the same.

hd-idle.service - hd-idle - spin down idle hard disks
   Loaded: loaded (/lib/systemd/system/hd-idle.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-10-21 09:01:24 CEST; 7s ago
     Docs: man:hd-idle(8)
  Process: 8387 ExecStart=/usr/sbin/hd-idle $HD_IDLE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 8387 (code=exited, status=1/FAILURE)

paź 21 09:00:21 epc systemd[1]: Started hd-idle - spin down idle hard disks.
paź 21 09:00:21 epc hd-idle[8387]: symlinkPolicy=0, defaultIdle=60, defaultCommand=scsi, debug=false, devices=[{sdb sdb 0 scsi} {sdc sdc 0 scsi} {sdd sdd 0 scsi} {sde sde 0 scsi}], logFile=/var/log/hd-idle.log
paź 21 09:01:24 epc hd-idle[8387]: sdf spindown
paź 21 09:01:24 epc hd-idle[8387]: 2019/10/21 09:01:24 open /dev/sdf: no medium found
paź 21 09:01:24 epc systemd[1]: hd-idle.service: Main process exited, code=exited, status=1/FAILURE
paź 21 09:01:24 epc systemd[1]: hd-idle.service: Failed with result 'exit-code'.

from hd-idle.

adelolmo avatar adelolmo commented on June 29, 2024

Hi @exodus1984,

You can avoid this problem by setting the default idle to 0.
I your case, assuming you only want to spin down sda, you can use this configuration:

HD_IDLE_OPTS="-i 0 -c scsi -a sda -i 600 -l /var/log/hd-idle.log"

from hd-idle.

exodus1984 avatar exodus1984 commented on June 29, 2024

heh no :)
This is my current configuration

HD_IDLE_OPTS="-i 0 -a sdb -i 3600 -a sdc -i 3600 -a sdd -i 3600 -a sde -i 3600 -a sda -i 0 -l /var/log/hd-idle.log"

Unfortunately, now if I add a disk, I must remember to change the configuration. If there was an option to skip removable it would be simpler.

btw
Can I use sd [bcde]?

from hd-idle.

adelolmo avatar adelolmo commented on June 29, 2024

Let me analyze your configuration:

HD_IDLE_OPTS="-i 0 -a sdb -i 3600 -a sdc -i 3600 -a sdd -i 3600 -a sde -i 3600 -a sda -i 0 -l /var/log/hd-idle.log"

-i 0 indicates no disk is spun down by default
-a sdb -i 3600 disk sdb spins down after 1h
-a sdc -i 3600 disk sdc spins down after 1h
-a sdd -i 3600 disk sdd spins down after 1h
-a sde -i 3600 disk sde spins down after 1h
-a sda -i 0 disk sda never spins down. This piece is not needed because is the default behavior.

But back to your initial log, I noticed this defaultIdle=600 so that's why i suggested using default idle 0.

I understand that having to add new disks to the configuration might get annoying and hard to maintain, but it's the only quick solution I can think of right now.

Can you please show the logs of the application running with the new configuration?

from hd-idle.

exodus1984 avatar exodus1984 commented on June 29, 2024
hd-idle.service - hd-idle - spin down idle hard disks
   Loaded: loaded (/lib/systemd/system/hd-idle.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-10-18 15:41:14 CEST; 2s ago
     Docs: man:hd-idle(8)
 Main PID: 20254 (hd-idle)
    Tasks: 5 (limit: 4915)
   CGroup: /system.slice/hd-idle.service
           └─20254 /usr/sbin/hd-idle -i 0 -a sdb -i 3600 -a sdc -i 3600 -a sdd -i 3600 -a sde -i 3600 -l /var/log/hd-idle.log

paź 18 15:41:14 epc systemd[1]: Started hd-idle - spin down idle hard disks.
paź 18 15:41:14 epc hd-idle[20254]: symlinkPolicy=0, defaultIdle=0, defaultCommand=scsi, debug=false, devices=[{sdb sdb 3600 scsi} {sdc sdc 3600 scsi} {sdd sdd 3600 scsi} {sde sde 3600 scsi}], logFile=/var/log/hd-idle.log

But back to your initial log, I noticed this defaultIdle=600 so that's why i suggested using default idle 0.

I used it in case I added a disc and forgot to add it to sleep after 1 hour. However, -i 0 will be better - I will sooner see that one is not sleeping.

I understand that having to add new disks to the configuration might get annoying and hard to maintain, but it's the only quick solution I can think of right now.

I understand. My suggestion regarding --no-removable concerns new functionality, for possible implementation in the future.

You have to admit that the current configuration is just ugly :)

from hd-idle.

V33m avatar V33m commented on June 29, 2024

@exodus1984, I advice you to use label, id etc. instead of dev/sda. It's easy and work perfectly fine if you plug in and unplug drives. In my case, everything work as expected regardless if one drive is connected or three. So in your case, it would be something like:

HD_IDLE_OPTS="-i 0 -a /dev/disk/by-id/HDD_ID_1 -i 3600 -a /dev/disk/by-id/HDD_ID_2 -i 3600 -a /dev/disk/by-id/HDD_ID_3 -i 3600 -a /dev/disk/by-id/HDD_ID_4 -i 3600"

or by label if you want:

HD_IDLE_OPTS="-i 0 -a /dev/disk/by-label/HDD_LABEL_1 -i 3600 -a /dev/disk/by-label/HDD_LABEL_2 -i 3600 -a /dev/disk/by-label/HDD_LABEL_3 -i 3600 -a /dev/disk/by-label/HDD_LABEL_4 -i 3600"

You can ofcourse use both and mix it. And I don't agree with you that the current configuration is ugly. It's simple and have worked fine for the last ten years

from hd-idle.

adelolmo avatar adelolmo commented on June 29, 2024

Hi @exodus1984,

I agree that the service should be more resilient in this case.
As you suggested, the best thing to do in this case is to log the error and not to kill the program. I will solve this problem in the next release.

Thank you for your explanation :)

from hd-idle.

adelolmo avatar adelolmo commented on June 29, 2024

@V33m @exodus1984

One thing about using symlinks:
Please make sure that the symlink resolves to a disk and not to a partition.

tree /dev/disk/

tree shows the structure of the devices and resolves the symlinks. Make sure to use only synlinks resolving to e.g. ../../sda and not to ../../sda1.
hd-idle won't apply specific configuration to devices if the symlinks don't resolve to disks. Instead it will use the default configuration.

from hd-idle.

V33m avatar V33m commented on June 29, 2024

Yeah, I know. I see that I should have specified this in my last post. Thanks for the clarification 👍

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.