How to find physical location of /dev/sd* drives in linux

I wrote a lil script to help out with this.. The syntax is as follows:

finddrive.py sda

How this works is by lighting up the corresponding drive on the front panel for about 3 seconds.

#!/bin/sh

cmd="dd if=/dev/$1 of=/dev/null"
seconds=3

echo "Check front panel for indicator light"
$cmd&

cmdpid=$!
sleep $seconds

if [ -d /proc/$cmdpid ]
then
  # echo "terminating program PID:$cmdpid"
  kill $cmdpid
fi

Credits:  Fabio’s Blog

 

Leave a Reply

Close Menu
%d bloggers like this: