标签:热添加硬盘
有的时候因为硬盘空间不够,需要在线增加硬盘,有的时候因为无法识别就可能需要重启服务器。
这里介绍一下服务器在不重启的情况下,增加硬盘操作。
[root@dbackup ~]# fdisk -l Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 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 5221 41833260 8e Linux LVM Disk /dev/sdb: 193.2 GB, 193273528320 bytes 255 heads, 63 sectors/track, 23497 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn‘t contain a valid partition table Disk /dev/dm-0: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/dm-0 doesn‘t contain a valid partition table Disk /dev/dm-1: 209.2 GB, 209278992384 bytes 255 heads, 63 sectors/track, 25443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/dm-1 doesn‘t contain a valid partition table Disk /dev/dm-2: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/dm-2 doesn‘t contain a valid partition table
我硬盘里已经有2块硬盘,但是我刚才又增加了一块,有3块硬盘。
这里无法找到新的/dev/sdc
1.确定磁盘的总线号
[root@dbackup ~]# ls /sys/class/scsi_host/ host0
这里只有一个host0
2.重新扫描scsi总线来添加设备
[root@dbackup host0]# echo "- - -" > /sys/class/scsi_host/host0/scan
3.查看硬盘
[root@dbackup79 host0]# fdisk -l Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 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 5221 41833260 8e Linux LVM Disk /dev/sdb: 193.2 GB, 193273528320 bytes 255 heads, 63 sectors/track, 23497 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn‘t contain a valid partition table Disk /dev/dm-0: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/dm-0 doesn‘t contain a valid partition table Disk /dev/dm-1: 209.2 GB, 209278992384 bytes 255 heads, 63 sectors/track, 25443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/dm-1 doesn‘t contain a valid partition table Disk /dev/dm-2: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/dm-2 doesn‘t contain a valid partition table Disk /dev/sdc: 128.8 GB, 128849018880 bytes 255 heads, 63 sectors/track, 15665 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn‘t contain a valid partition table
多了一个sdc,下面就可以进行分区了。
说明:
以上可能会出现如
[root@backup ~]# ls /sys/class/scsi_host/ host0 host1 host2
三个总线,这需要逐个去重新扫描
[root@backup ~]# echo "- - -" > /sys/class/scsi_host/host0/scan [root@backup ~]# echo "- - -" > /sys/class/scsi_host/host1/scan [root@backup ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
或者如果你的环境不是scsi磁盘(sas/sata也属于scsi),则扫描的可能就是scsi_host了
本文出自 “枫林晚” 博客,请务必保留此出处http://fengwan.blog.51cto.com/508652/1844341
标签:热添加硬盘
原文地址:http://fengwan.blog.51cto.com/508652/1844341