Systems
SATA/SCSI Hot pluggin
Scan SCSI bus for hot plugged devices:
echo "- - -" > /sys/class/scsi_host/host<HOST>/scan
Spin down a device before hot plug removal:
echo 1 > /sys/block/<DEVICE>/device/delete
Software RAID (mdadm)
Taken from mdadm cheat sheet[1]
Creates a new array:
This creates a new level 1 (mirrored) array over two devices - sda and sdb.
mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2
Write the configuration:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Remove a disk from an array:
The disk needs to be failed first before it can be removed, although it's most likely in a failed state already.
mdadm --fail /dev/md0 /dev/sda1
and now remove it
mdadm --remove /dev/md0 /dev/sda1
Add a disk to an existing array:
mdadm --add /dev/md0 /dev/sdb1
Verifying the status of the RAID arrays:
cat /proc/mdstat
or
mdadm --detail /dev/md0