不重新启动Linux服务器添加新硬盘

物理连接磁盘:
[root@ ~]# fdisk /dev/sdbc

Unable to open /dev/sdbc
[root@ ~]# more /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02

[root@ proc]# cd scsi
[root@ scsi]# ls
device_info  mptspi  scsi  sg
[root@ scsi]# more device_info
'Aashima' 'IMAGERY 2400SP' 0x1
'CHINON' 'CD-ROM CDS-431' 0x1
'CHINON' 'CD-ROM CDS-535' 0x1
'DENON' 'DRD-25X' 0x1
'HITACHI' 'DK312C' 0x1
'HITACHI' 'DK314C' 0x1
'IBM' '2104-DU3' 0x1
'IBM' '2104-TU3' 0x1
'IMS' 'CDD521/10' 0x1
'MAXTOR' 'XT-3280' 0x1
'MAXTOR' 'XT-4380S' 0x1
'MAXTOR' 'MXT-1240S' 0x1
'MAXTOR' 'XT-4170S' 0x1
'MAXTOR' 'XT-8760S' 0x1
'MEDIAVIS' 'RENO CD-ROMX2A' 0x1
'MICROTEK' 'ScanMakerIII' 0x1
'NEC' 'CD-ROM DRIVE:841' 0x1
'PHILIPS' 'PCA80SC' 0x1
'RODIME' 'RO3000S' 0x1
'SUN' 'SENA' 0x1
'SANYO' 'CRD-250S' 0x1
'SEAGATE' 'ST157N' 0x1
'SEAGATE' 'ST296' 0x1
[root@ scsi]# ls
device_info  mptspi  scsi  sg
[root@ scsi]# more scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
 注:使用这个命令增加磁盘:
 echo "scsi add-single-device w x y z" > /proc/scsi/scsi

指定的参数值 w、x、y 和 z,如下所示:
w 是主机适配器标识,第一个适配器为零(0)
x 是主机适配器上的 SCSI 通道,第一个通道为零(0)
y 是设备的 SCSI 标识
z 是 LUN 号,第一个 LUN 为零(0)
注:可使用这个命令删除磁盘:echo "scsi remove-single-device w x y z" > /proc/scsi/scsi
[root@ scsi]# echo "scsi add-single-device 0 00 02 00"> /proc/scsi/scsi[root@ scsi]# more scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 02 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
[root@ scsi]# fdisk -l

Disk /dev/sda: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4699    37640295   8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  83  Linux

Disk /dev/sdc: 231.9 GB, 231928233984 bytes
255 heads, 63 sectors/track, 28197 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table
[root@ scsi]#
[root@ ~]# vi csdn.txt
[root@ ~]# fdisk -l

Disk /dev/sda: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/b958153f18761659e0d22f82cef2fdb4.html