How to remove the read failed after 0 of 4096 I/O error

from: https://freeshell.de/~jose/317/kludges/how-to-temove-the-read-failed-after-0-of-4096-io-error/

Recently in a very old server I had to remove a disk. My server was composed by two physical volumes: a RAID5 volume, shown as /dev/sda to the operating system by the SCSI controller, and a single hard disk as /dev/sdb.

My /dev/sdb, since there is no way to have a new disk with the same geometry, I decided to remove it.
The bios utility of my SCSI controller is quite strange and I cannot remove my une-disk logical volume without remove all the configuration.

root@arch:~# pvdisplay
  /dev/sdb: read failed after 0 of 4096 at 0: input/output Error
  /dev/sdb: read failed after 0 of 4096 at 146695716864: input/output Error
  /dev/sdb: read failed after 0 of 4096 at 146695774208: input/output Error
  /dev/sdb: read failed after 0 of 4096 at 4096: input/output Error
  — Physical volume —
  PV Name               /dev/sda1
  VG Name               vg_system
  PV Size               838,12 GiB / not usable 2,00 MiB
  Allocatable           yes
  PE Size               4,00 MiB
  Total PE              214559
  Free PE               21184
  Allocated PE          193375
  PV UUID               ZQQwAs-yGgP-LZXk-3cTy-yaOb-gijr-bnUCz4

So I’d better to leave my controller untouched and tell my linux CentOS to forget the /dev/sdb disk.

root@arch:~# echo 1 > /sys/block/sdb/device/delete

Linux系统下实现SCSI硬盘在线识别[转]

  在向服务器添加SCSI硬盘时,可以在服务器不停机的情况下,让系统识别出新插入的硬盘,具体步骤如下:
  第一步:将新硬盘插到机器上;
  第二步:以root用户运行命令:
  

echo "scsi add-single-device x y z u" > /proc/scsi/scsi

  其中:
  x是硬盘所在SCSI控制器号(一般机器就一个SCSI控制器,所以就是0);
  y是硬盘所在SCSI通道的编号(一般单通道的就是0,多通道的要看是哪个通道了);
  z是硬盘的SCSI ID号(可以通过具体插入的硬盘插槽来判断);
  u是硬盘的lun号(默认情况都是0)
  由于我是插入第三块硬盘,所以我运行的命令是:
  

echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi

  如果x y z参数不正确,系统是不能识别添加的硬盘的,可以通过查看/proc/scsi/scsi文件的内容来判断是否添加成功。添加好之后,这个文件中会多出一个设备。这个文件中包含系统识别到的所有SCSI设备的详细信息,包括厂商、型号、介质访问类型等。

  如果要移除硬盘,那么可以这样操作:
  第一步:以root用户运行命令:
  

echo "scsi remove-single-device x y z u" > /proc/scsi/scsi

  x y z u的定义同上
  第二步:物理上断开硬盘的连接。