Editing /etc/hdparm.conf

Hi altogether, :wave:

A few months ago I installed Linux/Lubuntu 20.04.2 LTS as a clean/fresh install.

All went well but I find myself faced with a phenomenon referring to my (external) HDD. This is a “Western Digital Technologies, Inc. Elements 25A2” and
this is where my system is installed, i.e. I run my Lubuntu from there.

As I want to avoid the much too frequent writing actions to the HDD (also known as the WD_IntellPark problem) I used to solve the problem that way:

I edited /etc/hdparm.conf by first establishing

ls -l /dev/disk/by-*/* | grep 'sd.$' | grep sdb # sdb currently my HDD
lrwxrwxrwx 1 root root  9 Mär  3 12:22 /dev/disk/by-id/usb-WD_Elements_25A2_57584C314135364855375855-0:0 -> ../../sdb

and then as a second step: at the end of /etc/hdparm.conf:

/dev/disk/by-id/usb-WD_Elements_25A2_57584C314135364855375855-0:0 {
                         apm = 254
                 #       apm_battery = 254
                 #       spindown_time = 0
                 }

This procedure worked well in bionic but now in focal this entry keeps being ignored and after each reboot the APM value is set to 128 once again (instead of 254). :thinking:

I already posted this topic at Question #695843 : Questions : hdparm package : Ubuntu but never received a reply. In the meantime the thread was closed.
So I thought I´d post it here, in case anyone has an idea. :blush:

Thanks a lot in advance.
Many greetings.
Rosika :slightly_smiling_face:

15 days without activity until automatic closing is really harsh. No idea why their system is so damn quick. Usually, the common bots on Github take 30 to 90 days to close issues that lack recent enough replies. On the other hand, there is little reason to stay on Launchpad as a developer, except you want native Ubuntu support for your app, for whatever reason.

You probably already looked at these, but I’m still going to post them just to have them here, or maybe there is 1 new idea or 2 in this list:

https://bbs.archlinux.org/viewtopic.php?id=196821

https://wiki.ubuntuusers.de/Archiv/WD_IntelliPark/
https://forum.ubuntuusers.de/topic/wd-intellipark-abschalten-bei-wd10earx-22n0yb0/
http://idle3-tools.sourceforge.net/
https://blog.bigsmoke.us/2010/05/13/disabling-intellipark-on-the-wd15ears

I think, it’d probably a good idea to use one of the native WD solutions, like with the .exe thing. Then you wouldn’t need to have a Linux-sided workaround for the issue which, again, might stop working any time. However, you probably don’t have a real Windows machine at your disposal.

Perhaps you need to search for a general solution to such a HDD problem, instead of searching for a specific fix for this specific IntelliPark issue. I know there are tons of threads about HDD problems. Sometimes the HDD turns off at random, but people want to keep it running (I was part of those people, back when I used a HDD that took ages to spin up, which happened about every 15 minutes), while other people want the HDD to be turned off, when it keeps running the majority of time.
So, I’m sure, as a last resort, you will be able to successfully apply one of the other workarounds that were already applied to a different variety of hard disks for a variety of reasons.

1 Like

Hi @Akito, :wave:

thanks so much for your very detailed reply. You certainly put great effort in providing so many links and suggestions. It´s highly appreciated. :heart: :+1:

A few of them (like the wiki.ubuntuusers page) I´ve known already but others were certainly new to me.

Well, I still have my old WIN8.1 OS installed on my inernal HDD of my PC but haven´t used it for years now. And frankly I´m not very eager to make use of it (various reasons).
I´ve been ALL-LINUX for quite a while now. :smiley:

In actual fact I´ve come up with a clumsy workaround for the “problem” myself.
As of focal I´ve been doing it that way (manual workaround):

mount | grep -i ext2 # yielding "sdb" as an example
sudo hdparm -B 254 /dev/sdb

That´s also o.k. for me. However I´m always looking for some kind of automation if possible.

I also posted a thread here:
https://forum.ubuntuusers.de/topic/eintrag-in-etc-hdparm-conf-wird-ignoriert/#post-9222899

and with the help of user dingsbums found a solution (which I haven´t put to the test so far):

He suggested:

I would do something like this for every start using a small script and an additional entry for it in /etc/crontab (@reboot root /usr/local/sbin/set_hdparm.sh)

The script being:

#/usr/local/sbin/set_hdparm.sh
#!/bin/bash
serial="XXXXXXXXXXXXXXXXX" # find out serial of HDD by: lsblk -o name,serial
hdparm -B 254 "/dev/$(lsblk -o name,serial | grep $serial | awk '{print $1}')"

I suppose I´d have to do chmod +x set_hdparm.sh before putting the script in /usr/local/sbin.

Perhaps I should try that solution after all. :blush:

In this forum I just wanted to find out if anyone knows why editing “/etc/hdparm.conf” doesn´t seem to work anymore.

So thank you very much @Akito for your help. You´re very kind as ever.

Many greetings.
Rosika :slightly_smiling_face:

1 Like