NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sr0 11:0 1 9.8G 0 rom /run/media/redhat/RHEL-9-3-0-BaseOS-x86_64
/dev/nvme0n1 259:0 0 20G 0 disk
├─/dev/nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─/dev/nvme0n1p2 259:2 0 1G 0 part /boot
└─/dev/nvme0n1p3 259:3 0 18.4G 0 part
├─/dev/mapper/rhel-root
│ 253:0 0 16.4G 0 lvm /
└─/dev/mapper/rhel-swap
253:1 0 2G 0 lvm [SWAP]
/dev/nvme0n2 259:4 0 10G 0 disk
├─/dev/nvme0n2p1 259:5 0 2G 0 part
├─/dev/nvme0n2p2 259:6 0 1K 0 part
└─/dev/nvme0n2p5 259:7 0 1G 0 part
/dev/nvme0n3 259:8 0 5G 0 disk
/dev/nvme0n4 259:9 0 15G 0 disk
[root@xiaoming ~]# fdisk /dev/nvme0n3
Command (m for help): p
Disk /dev/nvme0n3: 5 GiB, 5368709120 bytes, 10485760 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: dos
Disk identifier: 0x2f1bd36b
Command (m for help): o
Created a new DOS disklabel with disk identifier 0x04776774.
Command (m for help): p
Disk /dev/nvme0n3: 5 GiB, 5368709120 bytes, 10485760 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: dos
Disk identifier: 0x04776774
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):
First sector (2048-10485759, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-10485759, default 10485759): +3g
Created a new partition 1 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.
[root@xiaoming ~]# mkfs.ext2 /dev/nvme0n3p1
[root@xiaoming ~]# blkid
[root@xiaoming ~]# mkdir /guazai1
[root@xiaoming ~]# mount /dev/nvme0n3p1 /guazai1
[root@xiaoming ~]# mount
[root@xiaoming ~]# cd /guazai1
[root@xiaoming guazai1]# echo this is fist disk > 1.txt
2.
[root@xiaoming ~]# fdisk /dev/nvme0n5
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 0x848845c0.
Command (m for help): p
Disk /dev/nvme0n5: 10 GiB, 10737418240 bytes, 20971520 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: dos
Disk identifier: 0x848845c0
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):
First sector (2048-20971519, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): +4g
Created a new partition 1 of type 'Linux' and of size 4 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):
First sector (8390656-20971519, default 8390656):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (8390656-20971519, default 20971519): +5g
Created a new partition 2 of type 'Extended' and of size 5 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 (8392704-18876415, default 8392704):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (8392704-18876415, default 18876415): +1g
Created a new partition 5 of type 'Linux' and of size 1 GiB.
Command (m for help):
All unwritten changes will be lost, do you really want to quit? n
Command (m for help): p
Disk /dev/nvme0n5: 10 GiB, 10737418240 bytes, 20971520 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: dos
Disk identifier: 0x848845c0
Device Boot Start End Sectors Size Id Type
/dev/nvme0n5p1 2048 8390655 8388608 4G 83 Linux
/dev/nvme0n5p2 8390656 18876415 10485760 5G 5 Extended
/dev/nvme0n5p5 8392704 10489855 2097152 1G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@xiaoming ~]# mkfs.ext3 /dev/nvme0n5p1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 1048576 4k blocks and 262144 inodes
Filesystem UUID: d6dafba2-7647-4c8b-8b33-cf0aee6239f4
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
[root@xiaoming ~]# mkdir /guazai2
[root@xiaoming ~]# mount /dev/nvme0n5p1 /guazai2
[root@xiaoming ~]# mount
[root@xiaoming ~]# echo The first primary partition on the second disk > 2.txt
[root@xiaoming ~]# mkdir /guazai3
[root@xiaoming ~]# mount /dev/nvme0n5p2 /guazai3
[root@xiaoming ~]# mount
[root@xiaoming ~]# echo Logical partition on the second disk > 3.txt
3.
[root@xiaoming ~]# fdisk /dev/nvme0n4
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 0x7e711b37.
Command (m for help): p
Disk /dev/nvme0n4: 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: dos
Disk identifier: 0x7e711b37
Command (m for help): g
Created a new GPT disklabel (GUID: 93C26896-42A0-DE49-8182-C38A9FC1EF4F).
Command (m for help): p
Disk /dev/nvme0n4: 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: 93C26896-42A0-DE49-8182-C38A9FC1EF4F
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-31457246, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31457246, default 31457246): +6g
Created a new partition 1 of type 'Linux filesystem' and of size 6 GiB.
Command (m for help): p
Disk /dev/nvme0n4: 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: 93C26896-42A0-DE49-8182-C38A9FC1EF4F
Device Start End Sectors Size Type
/dev/nvme0n4p1 2048 12584959 12582912 6G Linux filesystem
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@xiaoming ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sr0 11:0 1 9.8G 0 rom /run/media/redhat/RHEL-9-3-0-BaseOS-x86_64
/dev/nvme0n1 259:0 0 20G 0 disk
├─/dev/nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─/dev/nvme0n1p2 259:2 0 1G 0 part /boot
└─/dev/nvme0n1p3 259:3 0 18.4G 0 part
├─/dev/mapper/rhel-root
│ 253:0 0 16.4G 0 lvm /
└─/dev/mapper/rhel-swap
253:1 0 2G 0 lvm [SWAP]
/dev/nvme0n2 259:4 0 10G 0 disk
├─/dev/nvme0n2p1 259:5 0 2G 0 part
├─/dev/nvme0n2p2 259:6 0 1K 0 part
└─/dev/nvme0n2p5 259:7 0 1G 0 part
/dev/nvme0n3 259:8 0 5G 0 disk
└─/dev/nvme0n3p1 259:9 0 3G 0 part
/dev/nvme0n4 259:10 0 15G 0 disk
└─/dev/nvme0n4p1 259:16 0 6G 0 part
/dev/nvme0n5 259:11 0 10G 0 disk
├─/dev/nvme0n5p1 259:12 0 4G 0 part /guazai2
├─/dev/nvme0n5p2 259:13 0 1K 0 part
└─/dev/nvme0n5p5 259:14 0 1G 0 part
[root@xiaoming ~]# mkfs.xfs /dev/nvme0n4p1
[root@xiaoming ~]# mkdir /guazai4
[root@xiaoming ~]# mount /dev/nvme0n4p1 /guazai4
[root@xiaoming ~]# mount
[root@xiaoming guazai4]# vim 4.txt
[root@xiaoming guazai4]# cat 4.txt
This is a partition formatted in GPT (GUID Partition Table) format."