-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix encrypted hard drive #62
Comments
I think we both working on the same problem. |
@Schneck1 Thanks for your hint about udisks2. It may be the reason in my case too.
Right, because these 10min polls are happening on device (not partition) level:
(sda polled, dm-2 (on sda) not) If hd-idle will check only partition (dm-2) instead of (raw) drive (sda), we can keep those monitoring tools install while still being able to put drives to sleep. This behavior is implemented for normal partitions already (sda1...) |
@allofmex |
udisk2 does not spin-up, it's device access just increases the diskstats of the device. So hd-idle does not spin down because it believes that there was an access. As said before, you implemented the needed feature already (#48) by reading disk stats of sda1 instead of sda. Later you reverted the change for encrypted disks (#51). But encrypted drives do have visible partitions. All what needs to be implemented is to search for dm-x partitions of sda drive, and to use partitions stats instead of device stats. (see suggest in my first post) |
Thank you for your explanation, now I understand the situation. |
Hi, What could be helpful is that there's also a Here's an example on my system for the /dev/sdb device.
The relation between
|
I'm somewhat in the same boat since I want to start using LUKS. Have anyone setup LUKS and got it to work with hd-idle? My setup is simple. The whole external drive is encrypted, so I decrypt it and then mount it to /mnt/usb in fstab. Here are the paths which I might use, as well as by uuid (/dev/disk/by-uuid/UUID)
Adding any of them or all to the hd-idle config does not seem to spin down the drive. I get the following for all the paths by running
Should I create two partions for my decrypted device instead of only one?
|
I think I'm having the same issue? I also use LUKS for my drives, but both my drives are also running Linux RAID (mirror). Timeout is set to 1800 and after this time passes, only one of the two drives spins down - it's always sdb getting spun-down by hd-idle, but not sda. I can manually spin-down sda without issues. Info:
As suggested by the reported, setting the timeout below 600 does fix the issue, allowing both drives to spin-down. |
Hey all! I'm here to share some insights on how I'm using symlinks with LUKS where previous by-label, by-uuid etc. are not possible.
We need to point hd-idle against the
Here we see that we can either use
@adelolmo Feel free to edit and post the information as you like in |
@V33m |
Here is the documentation: https://github.com/adelolmo/hd-idle#luks-support I would like to get feedback from some of you before closing this issue. |
I'm afraid @V33m procedure doesn't help for the issue with disks not spinning down when using LUKS. hd-idle will resolve the symlink and lookup stats from The real fix is to lookup statistics from the device mapper device used by LUKS (as explained in previous comments). |
Correct, my insights likely do not not cover all the different scenarios here. There might be differences on kernel level as LUKS and hd-idle is working fine for me on a 4.9 kernel setup after decreasing the timeout to 10 minutes (600 seconds) and changing symlinks where I was not able to spindown the harddrives prior. I'll move to kernel 5.10 (LTS) when I find time in the next weeks. So for me, monitoring device stats ( |
When using LUKS, activity happens on the device mapper device. Fixes adelolmo#62.
@spasche and all
Could you please try out the pre-release v1.17? https://github.com/adelolmo/hd-idle/releases/tag/v1.17 |
Thanks for the new release! I installed it yesterday and it's working as expected. I'm now able to run smartctl regularly on the drive for monitoring and it will still spin down 🎉 |
My problems with the 10min limit also gone with 1.17, many thx! |
This extends on PR 48 Use partitions read/write to calculate disk activity and Issue 38 only calculate partition access:
hd-idle (1.16) is still not working on newer kernel if timeout is set to >=600 seconds and the complete device is encrypted (no partitions).
For encrypted drives, idle checks should be done on partition level too (same as since #48 for unecrypted).
As far as I understand, the encrypted partitions are the dm-0, dm-1,... entries in /proc/diskstats.
So hd-idle should check dm-x partition for activity instead of device itself.
Only thing to find out is what dm-? partition maps to the device:
Could be done via looping through
/sys/block/dm-?
. Directoryslaves
has device name. (Maybe there is even a better way)In this example, to idle sda, dm-2 needs to be monitored
/sys/block/dm-2/slaves/sda/
hd-idle 1.16
5.11.0-37-generic, 20.04.2-Ubuntu
The text was updated successfully, but these errors were encountered: