Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to prevent external HD to spin down

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

How to prevent external HD to spin down

#1 Post by fred44nl »

on my machine, which s running Debian 9.6, I have an external usb-hdd - Toshiba Canvio 1TB usb3
works all very well, but this usb-hdd spins down very quickly.

how can I stop my usb-hdd from spinning down ??

what I've done so far is issue commands using hdparm.

Code: Select all

sudo hdparm -B255 /dev/sdb
this should turn off Power Management

Code: Select all

sudo hdparm -S0 /dev/sdb
this should turn off spinning down, but it does not.

I added the following to end of /etc/hdparm.conf (and rebooted):
/dev/sdb {
apm = 255
spindown_time = 0
}
but after some time, I always get this:
fred44nl@Debian:~$ sudo hdparm -C /dev/sdb

/dev/sdb:
drive state is: standby
smartctl tells me:
APM feature is: Disabled
what else is there ??
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: How to prevent external HD to spin down

#2 Post by Segfault »

What else is there? Braindead manufacturers of hardware who think their device should control the drive instead of OS. Maybe they think their "power saving" is going to save the world. Probably the only remedy is a script that performs reads on the drive often enough to prevent it from spinning down.

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to prevent external HD to spin down

#3 Post by fred44nl »

does this mean that I have to do something with cron ??
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: How to prevent external HD to spin down

#4 Post by Segfault »

https://www.startpage.com/do/dsearch?qu ... ge=english

Hint. Searching the net is faster than waiting for someone to do it for you. Enjoy.

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to prevent external HD to spin down

#5 Post by fred44nl »

Segfault wrote: Hint. Searching the net is faster than waiting for someone to do it for you. Enjoy.
yes, I know :)
found the default spinning down delay, which is 3 mins.
so, I became root for a while and did ctrontab -e
added the following line at the bottom:

Code: Select all

* * * * * /bin/touch /dev/sdb &>/dev/null
this seemed to work well, but after a few hours the drive was in standby again.
so now I have to find another command :)
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to prevent external HD to spin down

#6 Post by fred44nl »

I change the crontab line to:

Code: Select all

* * * * * /sbin/hdparm -S0 /dev/sdb &>/dev/null
seems to do the job :)
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to prevent external HD to spin down

#7 Post by fred44nl »

this morning, my system crashed, for no reason.
so, I will remove this crontab for a while.

any suggestions for a different crontab line are welcome :)
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: How to prevent external HD to spin down

#8 Post by arzgi »

fred44nl wrote:this morning, my system crashed, for no reason.
so, I will remove this crontab for a while.

any suggestions for a different crontab line are welcome :)
Usually drives spin down to save energy, if you have not changed anything related to that after installation, check bios/uefi settings.

Spinning down should not cause any problems, the drive should spin up when needed automatically.

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to prevent external HD to spin down

#9 Post by fred44nl »

arzgi wrote: Spinning down should not cause any problems, the drive should spin up when needed automatically.
spinning down and up again is not very helpful for the life-time expectation :)
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: How to prevent external HD to spin down

#10 Post by bw123 »

https://duckduckgo.com/html/?q=apm+Toshiba+Canvio

first hit...
http://www.technomatters.net/2014/10/to ... ction.html
fred44nl wrote: spinning down and up again is not very helpful for the life-time expectation :)
That's not exactly true, spinning constantly generating heat isn't helpful either. Some drives do seem to degrade after a large number of spinup/down cycles (usually a huge number, takes yrs to cause a problem), but it is not a general fact that spinning down is worse than constantly spinning. It's an interesting topic, and you can run your drives the way you want.

https://www.backblaze.com/b2/hard-drive-test-data.html
resigned by AI ChatGPT

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to prevent external HD to spin down

#11 Post by fred44nl »

the Toshiba Canvio is now 2 1/2 years old.
the 1st year it was running Raspberry Lite, directly from the usb-hdd
the last year and a half it has been connected to my Fitlet2, which runs Debian from the internal SSD.

as I have not been able to disable the power management or preventing the usb-hdd from spinning down,
the command smartctl gives the following info regarding the use of the usbhdd, for so far:

Code: Select all

fred44nl@Debian:~$ sudo smartctl -A  /dev/sdb
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-6-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   050    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   100   100   050    Pre-fail  Offline      -       0
  3 Spin_Up_Time            0x0027   100   100   001    Pre-fail  Always       -       2697
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       17442
  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   050    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   100   100   050    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0032   047   047   000    Old_age   Always       -       21414
 10 Spin_Retry_Count        0x0033   253   100   030    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       132
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       87
193 Load_Cycle_Count        0x0032   030   030   000    Old_age   Always       -       700953
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       20 (Min/Max 12/50)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
220 Disk_Shift              0x0002   100   100   000    Old_age   Always       -       0
222 Loaded_Hours            0x0032   085   085   000    Old_age   Always       -       6314
223 Load_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
224 Load_Friction           0x0022   100   100   000    Old_age   Always       -       0
226 Load-in_Time            0x0026   100   100   000    Old_age   Always       -       190
240 Head_Flying_Hours       0x0001   100   100   001    Pre-fail  Offline      -       0
first off, the usb-hdd looks in good condition, as there are no errors or reallocatons.
however the ID# 193 concerns me, as the value for LCC is far beyond what's accepted as normal.

the obvious advice would be to replace the usb-hdd.
the question is: what make or model ??
besides Toshiba there is Adata, Intenso Memory Case, Maxtor M3 Portable, Seagate Expansion Portable, Verbatim, just to mention a few.
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

Post Reply