linux下不重啓加硬盤

linux下熱加載磁盤linux

臨時給虛擬機加了一塊硬盤,增長後懶得重啓,因而看了看熱加載centos

[root@centos5 ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
#注意紅色字體這行,咱們主要依據這行作熱加載

scsi0   爲x <- 是硬盤或者磁帶機所在SCSI控制器號
Channel  爲y   <-是硬盤或者磁帶機所在SCSI通道的編號
id     爲z   <-是硬盤或者磁帶機的SCSI ID號
lun     爲u <-是硬盤或者磁帶機的lun號默認狀況都是0

熱增長一個磁盤很簡單:
echo "scsi add-single-device x y z u"> /proc/scsi/scsi
這裏,咱們是單機,顯然,x y u都是固定的,只有scsi id是不一樣的
因此只須要
echo "scsi add-single-device 0 0 1 0"> /proc/scsi/scsi
就能夠增長磁盤
下面來測試一下:

 [root@centos5 ~]# fdisk -l 
Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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         535     4192965   82  Linux swap / Solaris
/dev/sda3             536       13054   100558867+  83  Linux
 

只看到一個磁盤測試

執行命令看看:字體

[root@centos5 ~]# echo "scsi add-single-device 0 0 1 0"> /proc/scsi/scsi
[root@centos5 ~]# fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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         535     4192965   82  Linux swap / Solaris
/dev/sda3             536       13054   100558867+  83  Linux

Disk /dev/sdb: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
[root@centos5 ~]# 

ok,磁盤增長成功spa

相關文章
相關標籤/搜索