Dietpi doesn't put my disk to sleep when not used - "bad/missing sense data"


I have a Western Digital USB3.0 6To HDD. It works quite well, but when it runs it’s a bit noisy (and it gets more and more noisy every month. I guess it’s normal over time).

But I noticed that it never goes to sleep. My Raspberry Pi 4 never puts the disk to sleep. I first looked if there was apps always using the disk and preventing it from going to sleep, so I installed iotop and looked for writes/reads. It appears there is no special app using the disk constantly.

So the problem is elsewhere. I tried again setting up the sleep timer in dietpi-drivemanager. I notice that the output is this :

[ INFO ] DietPi-Drive_Manager | Applying spindown timeout to all drives now...

 setting Advanced Power Management level to 0x7f (127)
SG_IO: bad/missing sense data, sb[]:  70 00 0b 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 setting standby to 36 (3 minutes)
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 24 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 APM_level      = not supported
[ INFO ] DietPi-Drive_Manager | Applying spindown timeout to /etc/hdparm.conf to be effective from next boot on...

Looks like there is an issue here. I don’t know what is causing it. I can’t find infos on this. Could someone help me to understand it ?

Thanks in advance for any answer. Any reply is welcome.
Have a great day !

It is normal that not all drives support APM, but they should support spindown. But the two errors are indeed not something I’ve seen yet. Could you try to run hdparm manually so that it applies the spindown timeout only:

hdparm -S 36 /dev/sda

This should also immediately spindown of the drive.

Thanks a lot for your answer !

I tried this command, and it still throws the same error. But the problem is also that it doesn’t put the drive to sleep. It looks like it does for half of a second though. It’s like a very brief stutter. But then it makes as much noise as before and doesn’t spindown.

What could be the cause of this ? I’m really worried that it could use my disk too much and damage it at the end. I found no solution so far and this forum is my only way out of this.

Thanks in advance for any answer, have a great day.

we had a couple of cases in past where it was needed to connect HDD to a Windows computer and use vendor tool to update HDD or to set timing for the disk to go into sleep mode.

Thanks for your answer. The problem is that my HDD is EXT4 formatted, so Windows doesn’t recognize it. I’m being very careful because there is 6tb of important data on it that I don’t want to lose. It’s a Western Digital WDBWLG0060HBK-EESN, to be more precise. Do you know if this one would require an update ? I didn’t see any paper or proprietaty software on it when I bought it, I don’t think WD has such things. But I could be wrong.

I’m using as well some WD red disk on my sinology nas and was able to connect them to my window desktop. There is no need to have them mounted and visible inside the explorer. Just have a look to WD website. They or offering tools like the dashboard to check and manage the disks.


I’m reviving this topic because I tried to tackle the issue again.
I plugged the disk into my Windows laptop, and installed WD Dashboard. The disk is correctly recognized by WD Dashboard, but there isn’t any setting I can tweak. I doesn’t even recognizes volumes on the disk. It may be because the disk is EXT4 formatted (I formatted it using dietpi) :

And there is no setting related to sleep time or anything related.

On Windows, the disk makes as much noise as on the Raspberry, and it’s very loud. It doesn’t seem to stop nor go to sleep, even with the EXT4 volume not mounted. What is strange is that the noise isn’t regular, and looks like something is being constantly written. And I don’t see how that could happen.

Strange. Windows cannot read/mount ext4 indeed, but that shouldn’t have an effect on the spindown, as long as Windows is not somehow constantly trying to identify and mount the drive. You should see a prompt in the explorer once, where Windows offers you to format the disk as it doesn’t detect a filesystem it understands, but when cancelling it should spindown after the timeout :thinking:.

If you have a change to copy data on it elsewhere, you could try to freshly format it on Windows as NTFS or exFAT and see whether the Dashboard shows more options then, and of course whether it then spins down at least on Windows, and probably as well in Linux/DietPi. Probably something has gone wrong during format on DietPi. In case freshly formatted it works well, on both OSes, of course it would be interesting whether reformatting as ext4 on DietPi reintroduces the issue.

Thanks for your answer.

That’s it, even windows doesn’t spindown when canceling formatting. It is only when I eject the disk on windows, or when I unplug on Rpi, that it really stops.

My problem is that it is a 6tb disk, nearly full, and I have no other disk I can move the data too. I can’t try formatting it again.

A bad formatting could be the issue, but I’m not sure about this as it wasn’t doing that much noise when I started using it. But it could be that some important files (related to filesystem maybe?) could have been corrupted during usage.

It is still under warranty, so I’m trying to see with western digital if I can get a replacement with data copy. But their support is awful and they didn’t answered after a week. I’ll see how it goes.

There is two things you can try:

  1. Check for filesystem errors and in case repair them:
umount /dev/sda1 # needs to be unmounted
fsck /dev/sda1

You may need to repeat that until it goes through without showing any error.

  1. Defrag the filesystem:
mount /dev/sda1 # needs to be mounted
e4defrag /dev/sda1

poking around found this't-go-to-sleep-after-timeout-by-hdparm-s-4175600915/

Which led me to a program that does the spindown for you
github page is here

They do have pre-compiled arm binaries that work with debian which Dietpi is based upon

There is also a script someone wrote that can be run as a cronjob to spin it down [might be a good way to add it to Dietpi to help spin down drives)

Thanks a lot for these suggestions.

I read that fsck can lead to data loss. I have 6tb of important files (Yeah, I should have a backup somewhere but I can’t have a 2nd 6tb disk right now). Does it happen very often with fsck or is it relatively safe ? If it is equivalent to windows’ drive recovery, it is pretty safe for me (never lost data with it) but maybe it’s risquier. Same question for defrag.

That’s very useful, it will give me much more control on this. I’ll try that right away, thanks !