So I have an Areca 1680ix raid card which I use to interface all of my disks with my operating system (usually pass-through). Since I do a lot of hot-swapping, it is necessary for me to rescan the scsi devices connected for the operating system to recognize them and give them a drive letter.

Additionally, you don't want this to disable any of your currently mounted drives. A lot of sites tell you to unload and relaod the kernel module that represents your raid card driver. I don’t really like this idea that much so I found another way thanks to this and this.

Getting the hostid

grep mpt /sys/class/scsi_host/host?/proc_name  

Rescan the bus

Edit the hostX with the ID from above.

echo "- - -" > /sys/class/scsi_host/hostX/scan  

Then go ahead ls your devices in /dev or run dmesg. You should have a new device attached.
Expanding an existing disk

Use this to rescan the disk geometry:

echo 1 > /sys/class/scsi_device/device/rescan  

Extras

I also recommend installing lsscsi and scsitools which provide some commands for managing your devices. And of course as any good sysadmin should do, smartmontools

apt-get install lsscsi scsitools  
Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview