一、添加三块硬盘:
1、第一块硬盘,虚拟机磁盘类型选择SCSI。大小选择5G

按mbr格式分区。分为两个主分区,大小分别为2G和3G。
[root@hfx ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.37.4).
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 disklabel with disk identifier 0x92333fa5.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-10485759, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-10485759, default 10485759): +2G
Created a new partition 1 of type 'Linux' and of size 2 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (4196352-10485759, default 4196352):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4196352-10485759, default 10485759): +3G
Value out of range.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4196352-10485759, default 10485759): max
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4196352-10485759, default 10485759): max
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4196352-10485759, default 10485759):
Created a new partition 2 of type 'Linux' and of size 3 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
第一个主分区创建ext2类型的文件系统。

第一个主分区挂载到/guazai1目录中,并在其中存入1.txt的文件,其文件内容是this is 1.txt。

第二个主分区创建ext3的类型的文件系统。

第二个主分挂载到/guazai2目录上,并在其中存入2.txt的文件。其中文件内容为this is 2.txt。

2、第二块硬盘,虚拟磁盘类型选择STAT。大小选择10G。

按mbr格式分区。分一个主分区,大小为1G,分一个扩展分区。大小为6G。分一个逻辑分区大小为4G。
[root@hfx ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.37.4).
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 disklabel with disk identifier 0x92adadab.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): +1G
Created a new partition 1 of type 'Linux' and of size 1 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 2
First sector (2099200-20971519, default 2099200):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-20971519, default 20971519): +6G
Created a new partition 2 of type 'Extended' and of size 6 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (2101248-14682111, default 2101248):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-14682111, default 14682111): +4G
Created a new partition 5 of type 'Linux' and of size 4 GiB.
Command (m for help): p
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x92adadab
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 14682111 12582912 6G 5 Extended
/dev/sda5 2101248 10489855 8388608 4G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
将主分区创建为ext4类型的文件系统。挂载到/guazai3目录。将其中存入3.txt的文件,其文件内容是this is 3.txt 。

将逻辑分区创建xfs类型的文件系统。挂载到/guazai4目录。在其中存入4.txt的文件,其文件内容是this is 4.txt。
[root@hfx ~]# mkfs.xfs /dev/sda5
meta-data=/dev/sda5 isize=512 agcount=4, agsize=262144 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=1048576, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@hfx ~]# blkid /dev/sda5
/dev/sda5: UUID="54d2dec2-91e6-4ea4-8289-a2bfcb641ff0" TYPE="xfs" PARTUUID="a9825600-05"
[root@hfx ~]# mkdir -p guazai4
[root@hfx ~]# mount /dev/sda5 /guazai4
[root@hfx ~]# df -h | grep /dev/sda5
/dev/sda5 4.0G 61M 3.9G 2% /guazai4
[root@hfx ~]# echo "this is 4.txt " > /guazai4/4.txt
[root@hfx ~]# cat 4.txt
ls: cannot access '888': No such file or directory
[root@hfx ~]# cat /guazai4/4.txt
this is 4.txt
3、第三块硬盘,虚拟磁盘类型选择NVME。大小选择15G。

按gpt格式分区。分一个主分区。大小为5G。
[root@hfx ~]# fdisk /dev/nvme0n2
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/nvme0n2: 15 GiB, 16106127360 bytes, 31457280 sectors
Disk model: VMware Virtual NVMe Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E1630369-B586-4ABC-AB4D-E304F6A6ABCD
Command (m for help): n
Partition number (1-128, default 1):
First sector (34-31457246, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31457246, default 31457246): +5G
Created a new partition 1 of type 'Linux filesystem' and of size 5 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
主分区创建xfs类型的文件系统,挂载到/guazai5目录,在其中存入5.txt的文件,其内容为this is 5.txt。
[root@hfx ~]# mkfs.xfs /dev/nvme0n2p1
meta-data=/dev/nvme0n2p1 isize=512 agcount=4, agsize=327680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=1310720, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@hfx ~]# mkdir /guazai5
[root@hfx ~]# mount /dev/nvme0n2p1 /guazai5
[root@hfx ~]# df -h | grep /dev/nvme0n2p1
/dev/nvme0n2p1 5.0G 68M 4.9G 2% /guazai5
[root@hfx ~]# echo "this is 5.txt " > /guazai5/5.txt
[root@hfx ~]# cat /guazai5/5.txt
this is 5.txt