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
相关文章
|
3月前
|
应用服务中间件 Linux nginx
让 CentOS 定时重启 Nginx
在CentOS上设置Nginx定时重启可通过`cron`或`systemctl`
204 0
|
2月前
|
网络协议 Linux
Linux——Centos8.2如何重启网卡服务
Linux——Centos8.2如何重启网卡服务
60 0
|
3月前
|
Linux
CentOS 7 上挂载硬盘到系统
在 CentOS 7 中挂载硬盘,步骤包括:1、查找未挂载磁盘;2、创建分区;3、格式化为 ext4;4创建挂载点;5、挂载硬盘;6、检查挂载状态;7、 编辑 `/etc/fstab` 以实现开机自动挂载。
206 3
|
4月前
|
Java Unix Linux
centos时刻检查java状态并重启
centos时刻检查java状态并重启
|
4月前
|
Linux Nacos
蓝易云 - CentOS7 Nacos设置开机自动重启
以上就是在CentOS 7上设置Nacos开机自动重启的详细步骤。
117 0
|
5月前
|
安全 关系型数据库 MySQL
|
5月前
记录-- 阿里云centos8 20G硬盘扩容100G
记录-- 阿里云centos8 20G硬盘扩容100G
102 0
|
Linux
Centos7 系列:磁盘挂载和磁盘扩容(新加硬盘方式)
在Centos 7 系统中,新添加硬盘,并将其挂载到自定义的新目录下;新添加硬盘,并为已有硬盘扩容。
3155 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
250 0
使用Vmware创建Centos7虚拟机(安装和配置网络环境、xshell连接、防火墙、yum仓库、磁盘挂载、重启命令)
下一篇
无影云桌面