linux disk hot-swapping

take a disk offline:

echo offline > /sys/block/sda/device/state

put a disk online:

echo running > /sys/block/sda/device/state

delete a disk before unplugging:

echo 1 > sys/block/sda/device/delete

scan for new hotplugged disks:

echo "0 0 0" > /sys/class/scsi_host/host/scan

display the controller IDs:

omreport storage controller

display the IDs for the physical disks attached to the controller:

omreport storage pdisk controller=0

displays property information for all virtual disks on all controllers

omreport storage vdisk

make sure that I’m dealing with the proper disks:
omconfig storage pdisk action=blink controller=0 pdisk=0:0:2
omconfig storage pdisk action=unblink controller=0 pdisk=0:0:2
omconfig storage pdisk action=blink controller=0 pdisk=0:0:3
omconfig storage pdisk action=unblink controller=0 pdisk=0:0:3
clear the configuration:

omconfig storage controller action=clearforeignconfig controller=0

check for the new virtual disk:

omreport storage vdisk

initialize a disk:

omconfig storage vdisk action=fastinit controller=0 vdisk=id

how to replace a disk on a dell server with several disks in a jbod configuration

umount /dev/sdg1
echo offline > /sys/block/sdg/device/state
echo 1 > sys/block/sdg/device/delete

install replacement disk, then:

echo "0 0 0" > /sys/class/scsi_host/host/scan
#
# WARNING!! WARNING!! Danger Will Robinson!!
# verify that the disk is the same device
#
fdisk -l /dev/sdg
#
echo running > /sys/block/sdg/device/state
parted /dev/sdg
mkfs.ext3 -m0 -L /disk6  /dev/sdg1
tune2fs -i0 -c0 /dev/sdg1
mount /dev/sdg1

fdisk /dev/sdg
>>>      Command (m for help): n (create new partition)
>>>      Partition number (1-4): 1
>>>      Command (m for help): p (create primary partition)
>>>      Command (m for help): w    (Write and save partition table)
mkfs.ext3 -L disk2 -m 0 /dev/sdg1
tune2fs -c 0 -i 0 /dev/sdg1
cat >>/etc/fstab <<EOM
LABEL=disk2           /disk2                   ext3    defaults        1 2
EOM
mkdir /disk2
mount -L disk2