So, just for fun, I decided to write up a blinking Disk Access IO LED script since I did not find a natural way to watch my hard drive in action. If you have another method that turns on disk activity LED, please feel free to post up and I’ll delete my script.
edit: I had to modify the script to allow a little breathing room for the slow processors. I added the 1 second sleep per loop and a 2 second sleep when the activity light lights up.
edit: one more thing, make sure the led lights are on under settings/Energy Saver/LED = ON
just copy and paste it into a text file called ioled.sh
#-------------------------cut here ------------------------------------------------------------
#!/bin/bash
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
source /usr/local/sbin/drive_helper.sh
[-f /usr/local/sbin/ledConfig.sh] && . /usr/local/sbin/ledConfig.sh
dataVolumeDisk=basename ${dataVolumeDevice}
led=0
while :; do
iow=awk -v disk="${dataVolumeDisk}" '{if ($3==disk) print $12}' /proc/diskstats
if [$((iow)) -eq 0]; then
if [$((led)) -eq 1]; then
ledCtrl.sh LED_EV_HALT LED_STAT_OK
led=0
fi
else
if [$((led)) -eq 0]; then
ledCtrl.sh LED_EV_DISK_STBY LED_STAT_OK
led=1
sleep 2 #let the light stay on for a longer duration
fi
fi
sleep 1 #allows some processor time between loops
done
#-------------------------cut here ------------------------------------------------------------
if you created the text file ioled.sh and saved it in your Public shares, you can find it in /shares/Public/ioled.sh
after you SSH into the device,
chmod 755 ioled.sh
Then you can run it at the prompt by
./ioled.sh
or you can use the ampersand at the end of the name for it to run in the background like this
./ioled.sh&
then you can exit the SSH, otherwise if you exit without the &, the script will stop when you exit SSH.
to run it at the lowest priority, you can use the “nice” command as follows
nice -19 ./ioled.sh&
and query how nice it is running
ps -fl -C “ioled.sh”
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
0 S root 24700 11481 11 99 19 - 564 pipe_r 21:14 pts/1 00:00:00 /bin/bash ./ioled.sh
So if you like this post, click on the star beside my name to give me kudos and I’ll be encouraged to share more.
Thanks for reading…