In servers that hold alot of drives, sometimes we are tasked with the nitty gritty of putting in drives into every slot. Imagine a unit with 12 to 24 slots, and your testing every disk… Try this script on while popping drives in one by one (dont pop in the next drive until you see it show up)…

This lists the bottom of dmesg with the “dmesg | tail -n 20” and also the output of the drives from “cat /proc/partitions”

LOCATE DRIVES SCRIPT – with mdev:
while true; do echo “—–“`date`”—-“; mdev -s; (dmesg | tail -n 10; cat /proc/partitions | egrep -v “[0123456789]$”; ) | egrep “^[^$#]”; sleep 3; done;
NOTE: with mdev you have to manually scan for new hardware with “mdev -s”
LOCATE DRIVES SCRIPT – with udev:
while true; do echo “—–“`date`”—-“; (dmesg | tail -n 10; cat /proc/partitions | egrep -v “[0123456789]$”; ) | egrep “^[^$#]”; sleep 3; done;
NOTE: with udev it auto detects new devices

 

Leave a Reply

Your email address will not be published. Required fields are marked *