Take a look at the manual page for hdparm. In particular the -B switch:
-B Get/set Advanced Power Management feature, if the drive supports
it. A low value means aggressive power management and a high
value means better performance. Possible settings range from
values 1 through 127 (which permit spin-down), and values 128
through 254 (which do not permit spin-down). The highest degree
of power management is attained with a setting of 1, and the
highest I/O performance with a setting of 254. A value of 255
tells hdparm to disable Advanced Power Management altogether on
the drive (not all drives support disabling it, but most do).
hdparamallows you set "levels": A low value means aggressive power management, i.e. less idle time before spin down and more frequent disk turn-offs. A high value means better performance, i.e. more idle time before spin down and less frequent turn-offs. -- The 255th level disables the spin-down. Your disk will be functioning normally all the time. – Jaime Sep 12 '17 at 21:32