首页 > 代码库 > linux不重启添加物理硬盘!
linux不重启添加物理硬盘!
生产环境有个服务器空间满了,需要扩容为了保证操作流畅提前预演了一下,虽然相关的文章很多了,还是记录一下。
# 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
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
# echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi #添加硬盘;
# 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
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
# fdisk -l #检查确认看到了添加的sdb磁盘,接下来分区格式化、挂载即可;
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a0593
Device Boot Start End Blocks Id System
/dev/sda1 * 1 66 524288 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 66 1371 10485760 83 Linux
/dev/sda3 1371 1893 4194304 83 Linux
/dev/sda4 1893 2611 5766144 5 Extended
/dev/sda5 1894 2155 2097152 82 Linux swap / Solaris
/dev/sda6 2155 2611 3666944 83 Linux
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000000
本文出自 “荣书” 博客,请务必保留此出处http://rongshu.blog.51cto.com/681368/1950203
linux不重启添加物理硬盘!