debian 8.2 dynamic add disk详解程序员

20170628 本次操作是完成虚拟机debian 动态添加磁盘

安装debian 8.2

省略

动态添加硬盘

vmware 里手动添加一块硬盘

[email protected]:/sys/devices/pci0000:00# ls -l /sys/class/scsi_host
总用量 0
lrwxrwxrwx 1 root root 0 6月 28 15:02 host0 -> ../../devices/pci0000:00/0000:00:07.1/ata1/host0/scsi_host/host0
lrwxrwxrwx 1 root root 0 6月 28 15:02 host1 -> ../../devices/pci0000:00/0000:00:07.1/ata2/host1/scsi_host/host1
lrwxrwxrwx 1 root root 0 6月 28 15:02 host2 -> ../../devices/pci0000:00/0000:00:10.0/host2/scsi_host/host2

刷新硬盘文件
# echo “- – -” > /sys/class/scsi_host/host0/scan
# echo “- – -” > /sys/class/scsi_host/host1/scan
# echo “- – -” > /sys/class/scsi_host/host2/scan
# cat /var/log/messages

Jun 28 15:05:27 debian1 kernel: [ 1450.116154] scsi 2:0:1:0: Direct-Access VMware, VMware Virtual S 1.0 PQ: 0 ANSI: 2
Jun 28 15:05:27 debian1 kernel: [ 1450.116177] scsi target2:0:1: Beginning Domain Validation
Jun 28 15:05:27 debian1 kernel: [ 1450.116682] scsi target2:0:1: Domain Validation skipping write tests
Jun 28 15:05:27 debian1 kernel: [ 1450.116684] scsi target2:0:1: Ending Domain Validation
Jun 28 15:05:27 debian1 kernel: [ 1450.116720] scsi target2:0:1: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)
Jun 28 15:05:27 debian1 kernel: [ 1450.117917] sd 2:0:1:0: [sdb] 41943040 512-byte logical blocks: (21.4 GB/20.0 GiB)
Jun 28 15:05:27 debian1 kernel: [ 1450.117947] sd 2:0:1:0: [sdb] Write Protect is off
Jun 28 15:05:27 debian1 kernel: [ 1450.118029] sd 2:0:1:0: [sdb] Cache data unavailable
Jun 28 15:05:27 debian1 kernel: [ 1450.118440] sdb: unknown partition table
Jun 28 15:05:27 debian1 kernel: [ 1450.118663] sd 2:0:1:0: [sdb] Attached SCSI disk
Jun 28 15:05:27 debian1 kernel: [ 1450.119722] sd 2:0:1:0: Attached scsi generic sg2 type 0
Jun 28 15:05:30 debian1 kernel: [ 1453.723352] floppy: error -5 while reading block 0
Jun 28 15:05:30 debian1 kernel: [ 1453.743412] floppy: error -5 while reading block 0

发现新的硬盘
[email protected]:/sys/devices/pci0000:00# fdisk -l

Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

之后一定要使用 linux lvm 的方式管理硬盘

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/1781.html

(0)
上一篇 2021年7月15日
下一篇 2021年7月15日

相关推荐

发表回复

登录后才能评论