1、首先给虚拟机添加一块10G的硬盘:
我们可以通过命令fdisk -l查看新加的磁盘是否被被识别到(/dev/sdb) :
Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 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:~# ls /sys/class/scsi_host/
host0 host1 host2
linux:~# echo '- - -' > /sys/class/scsi_host/host0/scan
linux:~# echo '- - -' > /sys/class/scsi_host/host1/scan
linux:~# echo '- - -' > /sys/class/scsi_host/host2/scan
然后执行fdisk -l查看新加的设备:
磁盘的分区:fdisk /dev/sdb
root:~# fdisk /dev/sdb # 分区的命令
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS di