New Toshiba HDD hdparm problems

Hi all, :wave:

after purchasing a new external HDD (Toshiba Canvio Partner 1 TB) and setting it up for my clonezilla backups I performed a disk backup using clonezilla live.
It went well.

Now I wanted to make some other backups of my USB sticks using this HDD as well.
To this end I employ grsync, so I can run the process from a running Linux Lite system.

Out of curiosity I took a look at

sudo smartctl -A -d sat /dev/sdb

(sdb being the external Toshiba HDD) and I noticed that the value Load_Cycle_Count kept increasing.
I was of the opinion only WD HDDs were affected by things like that. :thinking:

Anyhow, I looked at the “Advanced Power Management level” and saw it was set to 128 by default.
So I changed it, the same I do it on my WD HDD:

rosika@rosika-Lenovo-H520e ~> sudo hdparm -B /dev/sdb

sudo hdparm -B /dev/sdb
/dev/sdb:
 APM_level	= 128

rosika@rosika-Lenovo-H520e ~> sudo hdparm -B 254 /dev/sdb

/dev/sdb:
 setting Advanced Power Management level to 0xfe (254)
 APM_level	= 254
rosika@rosika-Lenovo-H520e ~> sudo hdparm -B /dev/sdb

/dev/sdb:
 APM_level	= 254

I thought it would be alright this way and the value of Load_Cycle_Count would stop increasing.

But it kept growing: :astonished:

Here´s part of the documentation:

rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       30
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       31
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       32
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       32
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep 
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       33
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       34
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       35
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       36
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       36
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       37
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       38
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       38
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       38
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       38
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       39
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       40
rosika@rosika-Lenovo-H520e ~> sudo smartctl -A -d sat /dev/sdb | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       41

etc.

Every few minutes the value increases by “1”. :angry:

So I unmounted the disk. But the value still keeps increasing. :astonished: :astonished:
What :question:
That cannot be, but it still does. :angry:

Can anyone come up with an explanation?
I´m at my wits end.

Thanks in advance and many greetings from Rosika :slightly_smiling_face:

Hi Rosika,
Load Cycle Count is number of times the head is parked.

I read this
" Some utilities, operating systems, and applications, such as some implementations of Linux, for example, are not optimized for low power storage devices and can cause our drives to wake up at a higher rate than normal. This effectively negates the power-saving advantages of low-power drives, such as WD GreenPower™ models, and artificially increases the number of load-unload cycles. "

So I would be thinking about whether some power management setting needs to be changed in your Linux.
and
If it did not work, set it back to 128, it might confuse things.

Regards
Neville

3 Likes

Thanks Neville, :wave:

Just checked, doesn´t seem to make any difference whether it´s set to 128 or to 254. The value just keeps growing.

But why does it keep growing after unmounting the disk?

That´s beyond me. :thinking:

Cheers from Rosika :slightly_smiling_face:

2 Likes

Unmount does not turn the power off

More info here

It seems there are other OEM tools which are better than hdparm.
and
it seems it is possible to turn off load cycling altogether so the disc spins whenever it is powered, and parks only at power off like old fashioned disks.

I think you will get there.

3 Likes

Hi Neville, :wave:

thanks a lot for the information and the link. :heart:
I´ll take a good at it.

Yes, you´re right of course.

I just set the standby (spindown) timeout for the drive to 10 secs:

sudo hdparm -S 2 /dev/sdb

(according to hdparm - ArchWiki )

but the value still keeps growing.
How on earth can that be?
With the HDD not spinning at all how can head parking take effect :question:

Load-unload cycles whith a non-spinning disk? :thinking:

Thanks a lot, Neville.

Cheers from Rosika :slightly_smiling_face:

2 Likes

If you remove the drive or restart the system does the number remain high or is it reset ?

That is possible… but crazy.
The head movement does not depend on the disk spinning, but I would have thought it was a bad thing to have a head moving across a stationary disk

Be careful what you do setting things with hdparm. It might do damage.
Read this

and note
" the settings set by hdparm command are volatile and get reset after the drive is powered down."

2 Likes

I think it is cumulative

2 Likes

Hi Rosika,

I never hear of this problem / concern, but did I did a quick search and found this. I hope it helps.

3 Likes

Hi all, :wave:

thanks so much for your replies :heart:

@callpaul.eu :

Thanks for the suggestion, Paul.

I checked today after a restart of the system. I also removed and re-connected the drive a few times.

sudo smartctl -A -d sat /dev/sda | grep Load_Cycle_Count
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       82

(It´s /dev/sda today)

So no resetting of the Load_Cycle_Count. Just keeps growing. :frowning_face:

@nevj :

Right you are, Neville, seems crazy indeed.

Yes, one has to see to it that the correct parameters are set:

-s (with a lower case “s”) can be dangerous:

-s Enable/disable the power-on in standby feature, if supported by the drive.

          VERY DANGEROUS.  Do not use unless you are absolutely certain that both  the
          system  BIOS (or firmware) and the operating system kernel (Linux >= 2.6.22)
          support probing for drives that use this feature. [...]

(man pages)

All I´ve ever used with hdparm are -g, -B and -S (uppercase “S”) options .

Yes, but with me it´s a case of Toshiba totally ignoring the hdparm commands. Seems the HDD has a built-in function which overrides them. :thinking:

Thanks for the link, Neville.

@easyt50 :

Thanks a lot, Howard.
I glanced over the page you recommended but it seems to hold nothing new for me. Sorry.

@ all:

I’ve been looking into the subject of Load-Cycle_Count for quite a while now, as my system disk is a WD one.
It has been affected from this phenomenon from the start but I can perfectly manage this one.

No problems here, as the WD HDD respects the hdparm settings without fail.
Here it´s simple:

Once I set the APM level to 254 the Load_Cycle_Count value doesn´t grow at all, no matter how long my session is.

When I power my system down in the evening and start it again the next day the Load_Cycle_Count has risen by the value of just 3 (during boot , I guess).
At the beginning of the session I set the APM value to 254 again and everything´s settled then.

So does not rise by more than 3 per day. :wink:

But - as I said - the Toshiba one simply ignores the settings. :angry:

Perhaps this issue might not be so severe after all, as the Toshiba HDD (which I just purchased) is for holding my monthly clonezilla backups only.
Well, and for holding my USB sticks backups as well.

So apart from one day per month the HDD is detached from my system.
But it still bugs me. :neutral_face:

I was thinking:

The head parking mechanism would kick in when the HDD is idle, right :question:
I.e. when nothing is written to it or no data retrieved from it.

Then a certain time has to elapse, perhaps 1 minute or two (don´t know the exact value) before head parking starts again.
I hope I got it right.

Well, what about creating a little script that sees to it that something is written to the HDD at certain intervals, like every 50 seconds or so?
Like writing and saving the word “Hello” to a text file which resides on the disk.

Wouldn´t that prevent the head parking from kicking in :question:

Just a thought.

Thanks again to you all.

Many greetings from Rosika :slightly_smiling_face:

2 Likes

Hi Rosika,
You only need to touch the file, or do a simple ls
Yes it should keep the drive active.

Is there any software available from Toshiba to manage this disk? If it is ignoring hdparm you need to use something else

Regards
Neville

3 Likes

Hi Neville, :wave:

Oh, I haven´t thought of this.

In the meantime I came up with a slightly more complicated script (admittedly with the help of ChatGPT :wink::

#!/bin/bash

# Detect the mount point of the external HDD
MOUNT_POINT=$(lsblk -o MOUNTPOINT,UUID | grep -E '/media/rosika/backups' | awk '{print $1}')

# If the mount point is not found, exit the script
if [ -z "$MOUNT_POINT" ]; then
  echo "HDD not mounted."
  exit 1
fi

# Define the file path on the external HDD
FILE_PATH="$MOUNT_POINT/keep_alive.txt"

while true; do
  # Write the word "Hello" to the file
  echo "Hello" >> "$FILE_PATH"
  # Flush the file system buffers
  sync
  # Truncate the file if it gets too large
  if [[ $(stat -c%s "$FILE_PATH") -gt 1024 ]]; then
    > "$FILE_PATH"
  fi
  # Sleep for 50 seconds
  sleep 50
done

Then run the script:

nohup ~/prevent_head_parking.sh &

and shut it down when you don´t need it any longer:

ps aux | grep prevent_head_parking.sh

and

kill <PID>

Explanation:

  • lsblk -o MOUNTPOINT,UUID: Lists block devices with their mount points and UUIDs.

  • grep -E '/media/rosika/backups': Filters for the specific mount point.

  • awk '{print $1}': Extracts the mount point path.

  • [ -z "$MOUNT_POINT" ] : Checks if the mount point was found. If not, the script exits with a message.

This script dynamically finds where the HDD is mounted, ensuring it writes to the correct path regardless of device name changes.
This way, you don’t need to worry about the device name changing across reboots. :wink:

The reasoning for running such a script was:

Writing a small amount of data to the disk at regular intervals should cause significantly less wear on the drive compared to the frequent head parking and unparking.

Do you agree :question:

Thanks a lot and many greetings from Rosika :slightly_smiling_face:

3 Likes

Agree, but you should check it has the intended effect

4 Likes

Thanks, Neville.

Yes, of course. I´ll check. :wink:

Cheers from Rosika :slightly_smiling_face:

3 Likes
#!/bin/bash

while true; do
# Detect the mount point of the external HDD
MOUNT_POINT=$(lsblk -o MOUNTPOINT | grep -E '/media/rosika/backups')

#Why use awk just to filter out UUID, when it's easier to omit from lsblk?

if [ ! -z "$MOUNT_POINT" ]; then
   # Define the file path on the external HDD
   FILE_PATH="$MOUNT_POINT/keep_alive.txt"
 
 # Write the word "Hello" to the file

  echo "Hello" >> "$FILE_PATH"
  # Flush the file system buffers
  sync
  # Truncate the file if it gets too large
  if [[ $(stat -c%s "$FILE_PATH") -gt 1024 ]]; then
    > "$FILE_PATH"
  fi
else
  echo "HDD not mounted."
fi
  # Sleep for 50 seconds
  sleep 50
done

ChatGPT can write buggy script too :rofl:
I’d do it differently:
That checks the mount point in the loop, and whenever you unmount the drive it won’t be defunct… :wink:
But I can write buggy script too, so double check whether my modifications are appropriate! :slight_smile:

4 Likes

Hi László, :wave:

thank you so much for your kind help. :heart:

Of course, you´re right.

This time I forgot to add my usual disclaimer: “Always take ChatGPT´s advice with a grain of salt.” :wink:

Your version looks splendid indeed. :+1:
I´ll use it for my purposes. Thanks a lot, László.

Well, it´s a good thing after all that I plan to use the Toshiba HDD for my backups only.
I didn´t even consider the possibility that it might behave in any other way that my WD HDD does.

The WD one accepts all hdparm settings whereas the Toshiba one does not.
So for running my Lnux Lite OS the WD one certainly seems to be the better choice.

Thanks again, László.

Many greetings from Rosika :slightly_smiling_face:

3 Likes

Yes, if you are going to force the disk to stay active you need to be careful to power it off when backup is finished.
and
If it is doing a backup, will it not be active anyway… so the script may be redundant.

3 Likes

Thanks, Neville, for your comments. :heart:

But I´m sorry to say: depite my best efforts the script doesn´t have the desired affect after all. :sob:

The Load_Cycle_Count still keeps growing. :astonished:

I tried to reduce the sleep value to 20 seconds. Again: No effect after all.

No idea what to try next.

Still: thanks a lot.

Cheers from Rosika :slightly_smiling_face:

Update:

Hang on.

I just reduced the sleep value even further. Reduced it to 10 secs.

Seems to work much better now.
The script has been running for more than 11 minutes now and the Load_Cycle_Count hasn´t increased so far. :wink:

I´ll keep testing.

4 Likes

Few other things to try:

Interesting part:

You calculate a spin-down time from this value of 128 using the description of -S and I think it’s wrong. This calculation confuses -B and -S. The same confusion occurs when you set APM to 241.

I’ve seen claims that hdparm -B 255 /dev/sdX helps. It disables Advanced Power Management though. My disk is set to 254 and it has what I think is a moderate Load_Cycle_Count with respect to Power_On_Hours: 200k and 20k respectively, so the ratio is way better than yours.

My advice is to use one of the following:

hdparm -B 127 /dev/sdX
hdparm -B 254 /dev/sdX
hdparm -B 255 /dev/sdX

You ue the -S right? Maybe give a try to the -B 255 option?

Then there is:

Interesting part:

I fixed this problem in my VAIO (TOSHIBA MQ01ABD075)

Load_Cycle_Count is not increased if you read any HDD S.M.A.R.T. option.

I use /usr/sbin/smartctl -g apm /dev/sda

#!/bin/bash

while :
  do
  sleep 3
  /usr/sbin/smartctl -g apm /dev/sda  > /dev/null
done

So there are some options left to try :wink:

4 Likes

Thank you so much, László. :heart:

I´ll read through the respective articles. I might stumble over a solution for me, too.

BTW:

The sript has been running for 29 min now and no increase of the Load_Cycle_Count has occurred.

But - as I said - I had to reduce the sleep value to 10 secs.

Does this statement still hold true under those circumstances :question:

What do you think?

Cheers from Rosika :slightly_smiling_face:

4 Likes