首页 > 代码库 > CentOS 6.8不重启在线增加硬盘
CentOS 6.8不重启在线增加硬盘
有的时候因为硬盘空间不够,需要在线增加硬盘,有的时候因为无法识别就可能需要重启服务器。
这里介绍一下服务器在不重启的情况下,增加硬盘操作。
[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
CentOS 6.8不重启在线增加硬盘
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。