CentOS 6.8不重启在线增加硬盘

简介:

有的时候因为硬盘空间不够,需要在线增加硬盘,有的时候因为无法识别就可能需要重启服务器。

这里介绍一下服务器在不重启的情况下,增加硬盘操作。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[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.确定磁盘的总线号

1
2
[root@dbackup ~] # ls /sys/class/scsi_host/
host0

这里只有一个host0


2.重新扫描scsi总线来添加设备

1
[root@dbackup host0] # echo "- - -" > /sys/class/scsi_host/host0/scan

3.查看硬盘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[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,下面就可以进行分区了。


说明:

以上可能会出现如

1
2
[root@backup ~] # ls /sys/class/scsi_host/
host0 host1 host2

三个总线,这需要逐个去重新扫描

1
2
3
[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了




本文转自 rong341233 51CTO博客,原文链接:http://blog.51cto.com/fengwan/1844341
相关文章
|
10天前
|
Java Unix Linux
centos时刻检查java状态并重启
centos时刻检查java状态并重启
|
1月前
|
安全 关系型数据库 MySQL
|
1月前
记录-- 阿里云centos8 20G硬盘扩容100G
记录-- 阿里云centos8 20G硬盘扩容100G
63 0
|
Linux
Centos7 系列:磁盘挂载和磁盘扩容(新加硬盘方式)
在Centos 7 系统中,新添加硬盘,并将其挂载到自定义的新目录下;新添加硬盘,并为已有硬盘扩容。
2639 0
Centos7 系列:磁盘挂载和磁盘扩容(新加硬盘方式)
|
应用服务中间件 Perl
Centos6.5下重启tomcat脚本
Centos6.5下重启tomcat脚本
|
缓存 Linux Shell
使用Vmware创建Centos7虚拟机(安装和配置网络环境、xshell连接、防火墙、yum仓库、磁盘挂载、重启命令)
## <font color=red>网络配置 NAT</font> 进入网卡页面: ```bash vim /etc/sysconfig/network-scripts/ifcfg-ens33 ``` 配置网络: ```bash TYPE=Ethernet BOOTPROTO=static NAME=ens33 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.2.10 NETMASK=255.255.255.0 GATEWAY=192.168.2.1 DNS1=114.114.114.114 ``` /etc/init.d/network r
200 0
使用Vmware创建Centos7虚拟机(安装和配置网络环境、xshell连接、防火墙、yum仓库、磁盘挂载、重启命令)
|
Linux 数据安全/隐私保护
【系统】[CentOS]装完CentOS7重启提示Initial setup of CentOS Linux 7 (core)
【系统】[CentOS]装完CentOS7重启提示Initial setup of CentOS Linux 7 (core)
403 0
【系统】[CentOS]装完CentOS7重启提示Initial setup of CentOS Linux 7 (core)
|
Shell Linux 网络安全
CentOS7下Docker重启容器后防火墙因重置失效的解决方式
在重启容器后,容器会重新挂载,不仅会导致/etc/下的某些文件失效,还会导致之前关闭的防火墙重新关闭,解决方式:
713 0
|
存储 Shell Linux
centos 6.5挂载硬盘
很多朋友对于LINUX的主机挂载经常询问我,现在把挂载教程进行分享,大家共同学习交流
355 0
centos 6.5挂载硬盘