Bug 205107 - No HDD spindown/parking on shutdown
Summary: No HDD spindown/parking on shutdown
Status: NEW
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: IDE (show other bugs)
Hardware: x86-64 Linux
: P1 high
Assignee: io_ide@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-06 23:18 UTC by Hélder
Modified: 2019-10-18 21:38 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.0.0-25-generic
Tree: Mainline
Regression: No


Attachments
SDB SMART log (5.20 KB, text/plain)
2019-10-06 23:18 UTC, Hélder
Details
SDA_SMARTCTL (5.03 KB, text/plain)
2019-10-11 23:31 UTC, Hélder
Details

Description Hélder 2019-10-06 23:18:27 UTC
Created attachment 285371 [details]
SDB SMART log

Greetings,

I've got an external Toshiba HDD in good conditions (USB 3.0 cable on USB 2.0 port) that I use to store backups and my work in.
Every time the system shuts down (either by terminal command or regular OS UI), the system does not wait for the hdd to park/spin down (as seen by the systemd logs), and instead, cuts the power off too early, making the disc make an acute screeching sound as if by hard power cutoff.

I believe the same thing is happening to my internal hdd (second one on linux, previous one was old and had the same problem), but I can't be sure as the sound isn't too clear.

I have reported this bug to the distribution's bug tracker (Lubuntu) and systemd, but I was requested to come here instead, as the problem must be down to the kernel.

I have tested this on Linux Mint and the same has happened. As additional information, both on Windows 10 and FreeBSD, this problem did not occur.

I'll attach smartctl logs for both HDDs. The logs say old_age and pre_fail, but this is most likely not true, as I have bought them recently and smartctl doesn't seem to be that smart at times.

I await your reply,
Hélder
Comment 1 Kaur Männamaa 2019-10-10 03:49:03 UTC
(In reply to Hélder from comment #0)

> 
> 
> I'll attach smartctl logs for both HDDs. The logs say old_age and pre_fail,
> but this is most likely not true, as I have bought them recently and
> smartctl doesn't seem to be that smart at times.
> 

old_age and pre_fail indicate the type of the data given, they are not the result of interpreting the data. Also, one of the logs seems to be missing unless I missed something myself :)

Could you unmount (umount -v your/drive*?) and then power off the external drive manually (udisksctl power-off -b /your/drive) and see if the problem remains? You might also want to check that the drive indeed is / has remained off before shutting down (hdparm -C /your/drive).
Comment 2 Hélder 2019-10-11 23:31:36 UTC
Created attachment 285477 [details]
SDA_SMARTCTL

sudo smartctl -a /dev/sda > sda_smartctl.txt
I have just run this.
Comment 3 Hélder 2019-10-11 23:35:18 UTC
The Power-Off Retract Count seems to match the amount of times the computer has shut down without notice. I have had the internal HDD for ~3 months, perhaps. Manufacturing date is around March, if I remember correctly.

As a side note I forgot to include, the external HDD had been formatted on Windows, so, unfortunately, it is still NTFS, but I don't think this influences the problem's cause.
Comment 4 Hélder 2019-10-11 23:45:09 UTC
I have just run those commands. The disk was unmounted and visibly shutdown. The problem did not remain here, but it still does on regular shutdown.

Side note: I'm not sure if this is expected, but even when I use "shutdown -P now", systemd appears to handle it still.
Comment 5 Hélder 2019-10-18 20:16:27 UTC
Anyone? As a temporary fix, I shut down all the devices before turning the system off manually with the following code:

#!/bin/sh
sudo umount -v /dev/sdb*
sudo umount -v /dev/sdc*
sudo umount -v /dev/sdd*
sudo udisksctl power-off -b /dev/sdb
sudo udisksctl power-off -b /dev/sdc
sudo udisksctl power-off -b /dev/sdd
sudo umount -v /dev/sda*
sudo udisksctl power-off -b /dev/sda


It is not a real fix, though.
Comment 6 Kaur Männamaa 2019-10-18 20:51:00 UTC
Apologies for the delay. I have not had time for the research my current (and rather limited) knowledge of the matter requires :) So far I have found quite a few descriptions involving external drives but the problem certainly isn't as massive as what we've had before (https://bugzilla.kernel.org/show_bug.cgi?id=7674).

We know now that in your case the drives remain off during shutdown if turned off manually beforehand. It's not much but it's a piece of the puzzle nevertheless.

You are using usb2, I found some reports of usb3 causing this. True, I have no idea (at least off the top of my head) about the kernel version that was used in these cases. In other words, such a problem can have all kinds of causes.

But while we're at it, are you sure you are not overthinking the problem? I mean, from what I understood from your previous post, your other drive (sda) was not affected by the issue? What about the others? In order to do any bug hunting & get some knowledgeable people involved we must know exactly which drives are affected. Nailing down the basics is crucial in deciding how much attention (if any) the bug will get.

Some further questions:

You said you tested with Mint. I assume the kernel version was the same?
Could you perhaps play around some more? Try with a live version of something (different kernel), maybe even try different systems.


As for your temporary fix, I would say it's a start and during my brief research on the issue I've seen quite a few versions of it used. Perhaps convert it into a systemd service to make the process smoother. It turns out udisksctl supports unmounting too, so you could even make it look nicer if you wanted to:)
Comment 7 Kaur Männamaa 2019-10-18 21:38:55 UTC
I noticed that you have filed the bug under IDE. Why? The drivers are SATA as I understand.

Note You need to log in before you can comment on or make changes to this bug.