My Guide to Debugging Disk Spin-ups

  • I was having some difficulty with a disk spinning up periodically and in the process of debugging it I created a small shell script which others might find useful if they have the same problem.


    What it does:
    - It writes out buffered data to the disk
    - Enables Block Dump Reporting
    - Puts the Drive into Standby (spin-down)
    - Then sits in a while loop waiting for the drive to spin back up.
    - When it does spin up it turns off the reporting and displays the messages relating to the drive you are watching.



    Run: find_culprit <drive>
    Example: find_culprit sdc
    (/dev/sdc is my spin disk)


    Output looks like this:


    So now I can see that the files:
    - Plex Media Server.log (in Logs)
    - com.plexapp.system.log (in PMS Plugin Logs)


    Were modified.


    In this case it was actually sync'ing the RAM directories back to the physical disk that woke it up (daily cron job). But this helps automate the work of finding what is accessing your disk and waking it up.

  • I tested your script, which is a great idea, as I have disks waking up for no apparent reason, but the only thing it says when the disk spins up is "Drive is awake"! There are no further messages. Could it be that the script doesn't work on a system also running the flashmemory-plugin?

    • Offizieller Beitrag

    flashmemory plugin shouldn't cause issues with that script.

    omv 7.0-32 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.9 | compose 7.0.9 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Offizieller Beitrag

    Hm, ok, so any ideas why the script just ends with "Drive is awake"? BTW I'm running OMV 2.2.13 with the backport kernel.

    hdparm either isn't putting the drive to sleep or it wakes back up within the 3 second delay that the script waits before it starts checking if the drive is in standby. I would say something is constantly using your drive.

    omv 7.0-32 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.9 | compose 7.0.9 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • No, no, it definitely puts the drive to sleep. Before the script gave the message "Drive is awake" it's saying "Drive is still in standby. Sleeping 45 seconds..." multiple times for half an hour or so.

    • Offizieller Beitrag

    Oh, you made it sound like it went to Drive is awake right away. What is the output of dmesg | grep -E "WRITE|dirtied"

    omv 7.0-32 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.9 | compose 7.0.9 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • The output is:

    Code
    [79302.183422] smbd(31521): dirtied inode 141885503 (index) on sdb1
    [79302.324836] smbd(31521): dirtied inode 141885504 (info) on sdb1
    [79302.335551] smbd(31521): dirtied inode 141885505 (marks) on sdb1
    [79302.344334] smbd(31521): dirtied inode 141885506 (resume) on sdb1


    sda is the drive I'm investigating why it's waking up. sda and sdb are both 8 TB Seagate Archive HDDs, sdc is the drive OMV is installed on and that is a USB-stick.

    • Offizieller Beitrag

    No idea why it is waking up then. Do you have smart tests enabled?

    omv 7.0-32 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.9 | compose 7.0.9 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Yes, I have set "Check interval" to the default 1800 and "Power Mode" to "Standby", but I have not scheduled tests.
    However there is a problem with the Seagate Archive disks that often results in hdparm -C /dev/sdx giving the result "drive state is: unknown". Maybe that is the cause for my problem, so that smartmontools wakes up the drive regardless of what is set as "Power Mode". The output of hdparm -C /dev/sdx is the same on both drives, but the frequent spin-ups seem to only happen on sda, which makes me wonder about a firmware-problem, because sda runs AR13 firmware and sdb is equipped with AR15. Seagate seem to offer updates to AR17 now, so I'll try to get it for both drives and see if the problem persists. Thanks!

  • Run: find_culprit <drive>
    Example: find_culprit sdc
    (/dev/sdc is my spin disk)

    dummy question here:


    how do I run this script?
    entering it on the omv console at my pi 4 only shows "Could not find the database of available applications, run update-command-not-found as root to fix this"


    I'm new to this (windows user)

    • Offizieller Beitrag

    Have a look at the guide which is linked in the signature. You need to use the CLI. If you are on Windows that means you need to use Putty (or powershell) to ssh into your server. Hope this becomes clearer after you read the section about Putty in the guide.


    Then you need to ssh into the server. Create a file using a editor called nano. It is already installed on your RPi. Copy the content of the script into that file. Safe the file. Then continue with the link I posted.


    OMV is based on Debian which is a standard Linux distribution. You find a lot support using google (or startpage or yahoo or whatever).

  • ok so i named it spindown.sh now
    when i follow your guide on how to run a script, the first 2 options dont do anything and after that its all
    "Could not find the database of available applications, run update-command-not-found as root to fix this"
    again


    Sorry to bother you but I dont get it..

  • The file is saved in that directory where you were when you started nano unless you specified a directory when starting nano.
    So for example launching nano with

    Code
    nano /tmp/test.txt

    would put that text-file into the "/tmp"-directory.
    Beware that /tmp usually gets deleted on shutdown/reboots of the system.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!