当前位置:首页 > 虚拟机 > 正文

虚拟机添加硬盘(怎么给虚拟机添加一块硬盘)


一、如何不用重启在CentOS7/RHEL7虚拟机中添加一块新硬盘向ESXi或vCenter添加新的20G硬盘:
显示当前磁盘分区:
Disk/dev/sda:32.2GB,32212254720bytes,62914560sectors
Units=sectorsof1*512=512字节
扇区大小(逻辑/物理):512字节/512字节
I/O大小(最小/最佳):512字节/512字节
磁盘标签类型:dos
磁盘标识符:0x0006b96a
DeviceBootStartEndBlocksIdSystem
/dev/sda1*2048102604751200083Linux
/dev/sda2102604862914559309442568eLinuxLVM
磁盘/dev/mapper/centos-swap:2147MB,2147483648字节,4194304扇区
单位=sectorsof1*512=512字节
扇区大小(逻辑/物理):512字节/512字节
I/O大小(最小/最佳):512字节/512字节
磁盘/dev/mapper/centos-root:29.5GB,29536288768字节,57688064扇区
Units=sectorsof1*512=512bytes
扇区大小(逻辑/物理):512bytes/512bytes
I/Osize(最小/最优):512bytes/512bytes
[root@centos7~]#fdisk-l
确定主机总线号
[root@centos7~]#ls/sys/class/scsi_host/
host0host1host2
重新扫描SCSI总线添加设备
[root@centos7~]#echo"---">/sys/class/scsi_host/host0/scan
[root@centos7~]#echo"---">/sys/class/scsi_host/host1/scan
[root@centos7~]#echo"---">/sys/class/scsi_host/host2/scan
验证磁盘和分区,确保20GB硬盘有已添加。本例中出现以下行“Disk/dev/sdb:21.5GB,21474836480bytes,41943040sectors”,无需重启服务器即可确认新磁盘已添加:
[root@centos7~]#fdisk-l
磁盘/dev/sda:32.2GB,32212254720字节,62914560扇区
Units=sectorsof1*512=512字节
扇区大小(逻辑/物理):512字节/512字节
I/O大小(最小/最佳):512字节/512字节
磁盘标签类型:dos
磁盘标识符:0x0006b96a
DeviceBootStartEndBlocksIdSystem
/dev/sda1*2048102604751200083Linux
/dev/sda2102604862914559309442568eLinuxLVM
Disk/dev/mapper/centos-swap:2147MB,2147483648bytes,4194304sectors
Units=sectorsof1*512=512bytes
扇区大小(逻辑/物理):512bytes/512bytes
I/Osize(最小)/optimal):512bytes/512bytes
磁盘/dev/mapper/centos-root:29.5GB,29536288768bytes,57688064sectors
Units=sectorsof1*512=512bytes
扇区大小(逻辑/物理):512bytes/512bytes
I/Osize(最小/最佳):512bytes/512bytes
磁盘/dev/sdb:21.5GB,21474836480bytes,41943040sectors
Units=sectorsof1*512=512bytes
Sectorsize(逻辑/物理):512字节/512字节
I/O大小(最小/最佳):512字节/512字节