centostricks

Just another WordPress.com site

Hot remove scsi Disk in Centos 6.x without reboot of OS


Hot remove SCSI disk without rebooting CentOS 5.x/6.x

Error message shown once the Disk is removed from Virtual Machine at VM Level….

[root@localhost ~]# tailf /var/log/messages
Aug 10 07:32:52 localhost kernel: end_request: I/O error, dev sde, sector 8
Aug 10 07:32:52 localhost kernel: sd 2:0:4:0: [sde] Unhandled error code
Aug 10 07:32:52 localhost kernel: sd 2:0:4:0: [sde] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
Aug 10 07:32:52 localhost kernel: sd 2:0:4:0: [sde] CDB: Read(10): 28 00 00 00 00 08 00 00 08 00
Aug 10 07:32:52 localhost kernel: end_request: I/O error, dev sde, sector 8
Aug 10 07:32:52 localhost kernel: sd 2:0:4:0: [sde] Unhandled error code
Aug 10 07:32:52 localhost kernel: sd 2:0:4:0: [sde] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
Aug 10 07:32:52 localhost kernel: sd 2:0:4:0: [sde] CDB: Read(10): 28 00 00 00 00 08 00 00 08 00
Aug 10 07:32:52 localhost kernel: end_request: I/O error, dev sde, sector 8

Parted is still showing information of /dev/sde, even after its removed from the Virtual Machine (VM)

[root@localhost ~]# parted -l
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 14.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  525MB   524MB   primary  ext4         boot
 2      525MB   14.0GB  13.4GB  primary               lvm

Error: /dev/sdb: unrecognised disk label                                  

Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End  Size  Type  File system  Flags

Error: /dev/sdd: unrecognised disk label                                  

Error: /dev/sde: unrecognised disk label                    

/proc/partitions is still showing information of /dev/sde, even after its removed from the Virtual Machine (VM)

[root@localhost ~]# cat /proc/partitions
major minor  #blocks  name

   8        0   13631488 sda
   8        1     512000 sda1
   8        2   13118464 sda2
 253        0   11051008 dm-0
 253        1    2064384 dm-1
   8       32    1048576 sdc
   8       48    1048576 sdd
   8       16    1048576 sdb
   8       64    1048576 sde

/proc/scsi/scsi is still showing information of /dev/sde, even after its removed from the Virtual Machine (VM)

[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 02 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 03 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 04 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02

REMOVING THE  /DEV/SDE FROM OPERATING SYSTEM WITH BELOW COMMAND !!!

[root@localhost ~]# echo “scsi remove-single-device 2 0 4 0” > /proc/scsi/scsi
[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 02 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi2 Channel: 00 Id: 03 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02

the above output no more shows info about “Host: scsi2 Channel: 00 Id: 04 Lun: 00”

/dev/sde is no more shown now

[root@localhost ~]# cat /proc/partitions
major minor  #blocks  name

   8        0   13631488 sda
   8        1     512000 sda1
   8        2   13118464 sda2
 253        0   11051008 dm-0
 253        1    2064384 dm-1
   8       32    1048576 sdc
   8       48    1048576 sdd
   8       16    1048576 sdb
[root@localhost ~]#

/dev/sde is no more shown now

[root@localhost ~]# parted -l | grep “dev/sd*”
Disk /dev/sda: 14.0GB
Error: /dev/sdb: unrecognised disk label                                  
Disk /dev/sdc: 1074MB
Error: /dev/sdd: unrecognised disk label                                  
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
Error: /dev/sr0: unrecognised disk label

Good Luck !!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: