I have a external Hitachi Hard Drive that has the annoying "Advanced Power Management" feature, that puts the device to sleep, if I do not use it for a minute. It is also not possible to turn this feature off by using "sudo hdparm -B 128".
E.g. when I pause a video to make a short break, the player is not working properly and skips half a minute until the hard drive wakes.
In order to trick the HDD I wrote a small shell script, that constantly reads from the device, so it never falls asleep. It works just fine, but every time I use this script I get a kernel panick after some time.
Here is my shell script:
#!/bin/bash
if [[ "$(id -u)" != "0" ]]
then
sudo -s <<EOF
ionice -c3 pv -s 4000784052224 -q -L 1m '/dev/sdb' &> /dev/null
while [ $?==0 ]
do
sleep 1
ionice -c3 pv -s 4000784052224 -q -L 1m '/dev/sdb' &> /dev/null
done
EOF
else
ionice -c3 pv -s 4000784052224 -q -L 1m '/dev/sdb' &> /dev/null
while [ $?==0 ]
do
sleep 1
ionice -c3 pv -s 4000784052224 -q -L 1m '/dev/sdb' &> /dev/null
done
fi
I'm using Linux Mint 17.1 with the kernel version 3.16.0-031600-generic (the problem also accrued in the original kernel).
Do you have any idea, why that is happening?