Friday, February 8, 2008

Hot plugging of hard disk in Linux...

How to add/remove a Hot Plug Disk avoiding a reboot

1.#cat /proc/scsi/scsi
This will list all the SCSI devices known to the kernel.

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: SEAGATE Model: ST39204LC Rev: 0005
Type: Direct-Access ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: SEAGATE Model: ST3146807LC Rev: 0007
Type: Direct-Access ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 06 Lun: 00
Vendor: DELL Model: 1x4 U2W SCSI BP Rev: 1.16
Type: Processor ANSI SCSI revision: 02

2. In order to add a new hot plugged disk to the list of above known devices, run:

# echo scsi add-single-device 1 0 3 2 > /proc/scsi/scsi
This will cause the host scsi1 to scan on CHANNEL 0 for device ID 3 LUN 2

3. fdisk -l should list the device

4. In order to remove a known device

#echo scsi remove-single-device 0 0 6 0 > /proc/scsi/scsi

This will remove the disk from the list on scsi 0 CHANNEL 0 for device ID 6 LUN 0

No comments: