第一块硬盘的相关操作 添加硬盘并选择磁盘类型为SCSI 并进行分区
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 5G 0 disk
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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 2G 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 3G 0 lvm [SWAP]
[root@localhost ~]# 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 0x812a1003.
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): //选择类型(p:主分区 e:扩展分区)
First sector (2048-10485759, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-10485759, default 10485759): +2g //
设置主分区的大小为2GB
Created a new partition 1 of type 'Linux' and of size 2 GiB.
Command (m for help): p //查看主分区信息
Disk /dev/sda: 5 GiB, 5368709120 bytes, 10485760 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: 0x812a1003
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4196351 4194304 2G 83 Linux
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):
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): +1g
Created a new partition 2 of type 'Linux' and of size 1 GiB.
Command (m for help): p
Disk /dev/sda: 5 GiB, 5368709120 bytes, 10485760 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: 0x812a1003
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4196351 4194304 2G 83 Linux
/dev/sda2 4196352 6293503 2097152 1G 83 Linux
Command (m for help): wq //保存退出
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# mkfs.ext3 /dev/sda2 //创建文件系统为ext3
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 6f3b0973-6c3f-4b2f-a43f-bae9bf92da42
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]# blkid //查看信息
/dev/mapper/rhel-swap: UUID="c2b8e15c-8163-497b-a499-104fa577ea65" TYPE="swap"
/dev/nvme0n1p3: UUID="7h4Y8b-0jNh-0O3L-XH0W-YjnC-IneO-OKqET1" TYPE="LVM2_member" PARTUUID="50efc439-f349-4fa1-af72-fa59ee50b9c6"
/dev/nvme0n1p1: UUID="05B5-4150" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0eaddf46-c79b-459e-b993-ca63711c3bbb"
/dev/nvme0n1p2: UUID="553c905e-0820-4a51-82f7-ad3dd487d627" TYPE="xfs" PARTUUID="3405594d-0416-4f13-b586-2bf3c4a6698d"
/dev/sr0: UUID="2023-10-25-09-17-25-00" LABEL="RHEL-9-3-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="ece57f7f" PTTYPE="dos"
/dev/mapper/rhel-root: UUID="47528888-6441-4e77-ab90-ca520302d124" TYPE="xfs"
/dev/sda1: UUID="1bd6560c-0630-433a-947b-131f1d45fc55" TYPE="ext2" PARTUUID="812a1003-01"
/dev/sda2: UUID="6f3b0973-6c3f-4b2f-a43f-bae9bf92da42" SEC_TYPE="ext2" TYPE="ext3" PARTUUID="812a1003-02" //可以看到sda2 的类型为ect3
[root@localhost ~]# mkdir /guazai2
[root@localhost ~]# mount /dev/sda2 /guazai22
mount: /guazai22: mount point does not exist.
[root@localhost ~]# mount /dev/sda2 /guazai2
[root@localhost ~]# mount /dev/sda1 /guazai1
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 5G 0 disk
├─/dev/sda1 8:1 0 2G 0 part /guazai1
└─/dev/sda2 8:2 0 1G 0 part /guazai2
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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]
[root@localhost ~]# echo this is 1 > /guazai1/1.txt
[root@localhost ~]# ll /guazai1/1.txt
-rw-r--r--. 1 root root 10 Oct 20 15:03 /guazai1/1.txt
[root@localhost ~]# cat /guazai1/1.txt
this is 1.txt
[root@localhost ~]# mount /dev/sda2 /guazai22
mount: /guazai22: mount point does not exist.
[root@localhost ~]# mount /dev/sda2 /guazai2
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 5G 0 disk
├─/dev/sda1 8:1 0 2G 0 part /guazai1
└─/dev/sda2 8:2 0 1G 0 part /guazai2
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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]
[root@localhost ~]# echo this is 2 > /guazai2/2.txt
[root@localhost ~]# ll /guazai2/2.txt
-rw-r--r--. 1 root root 10 Oct 20 15:03 /guazai2/2.txt
[root@localhost ~]# cat /guazai2/2.txt
this is 2.txt
二.第二块硬盘
[root@localhost ~]# 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 0xc2529b75.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response 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): +2g
Created a new partition 1 of type 'Linux' and of size 2 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: 0xc2529b75
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4196351 4194304 2G 83 Linux
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# 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.
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 (4196352-20971519, default 4196352):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4196352-20971519, default 20971519): +6g
Created a new partition 2 of type 'Extended' and of size 6 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: 0xc2529b75
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4196351 4194304 2G 83 Linux
/dev/sda2 4196352 16779263 12582912 6G 5 Extended
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# 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.
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 (4198400-16779263, default 4198400):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4198400-16779263, default 16779263):
Created a new partition 5 of type 'Linux' and of size 6 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: 0xc2529b75
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4196351 4194304 2G 83 Linux
/dev/sda2 4196352 16779263 12582912 6G 5 Extended
/dev/sda5 4198400 16779263 12580864 6G 83 Linux
Command (m for help): lsblk -p
00 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
01 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
02 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
03 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT-
04 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
05 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
06 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
07 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
08 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
09 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
0a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
0b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
0c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Linux extended
0e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs
0f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT
10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto
1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep
1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT
Aliases:
linux - 83
swap - 82
extended - 05
uefi - EF
raid - FD
lvm - 8E
linuxex - 85
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# mkfs.ext4 /dev/sda2
mke2fs 1.46.5 (30-Dec-2021)
mkfs.ext4: inode_size (256) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
[root@localhost ~]# blkid
/dev/mapper/rhel-swap: UUID="c2b8e15c-8163-497b-a499-104fa577ea65" TYPE="swap"
/dev/nvme0n1p3: UUID="7h4Y8b-0jNh-0O3L-XH0W-YjnC-IneO-OKqET1" TYPE="LVM2_member" PARTUUID="50efc439-f349-4fa1-af72-fa59ee50b9c6"
/dev/nvme0n1p1: UUID="05B5-4150" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0eaddf46-c79b-459e-b993-ca63711c3bbb"
/dev/nvme0n1p2: UUID="553c905e-0820-4a51-82f7-ad3dd487d627" TYPE="xfs" PARTUUID="3405594d-0416-4f13-b586-2bf3c4a6698d"
/dev/sdb2: UUID="6f3b0973-6c3f-4b2f-a43f-bae9bf92da42" TYPE="ext3" PARTUUID="812a1003-02"
/dev/sdb1: UUID="1bd6560c-0630-433a-947b-131f1d45fc55" TYPE="ext2" PARTUUID="812a1003-01"
/dev/sr0: UUID="2023-10-25-09-17-25-00" LABEL="RHEL-9-3-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="ece57f7f" PTTYPE="dos"
/dev/nvme0n2p1: UUID="15dbb67c-4d62-45f0-ab0c-d200c4127801" TYPE="xfs" PARTUUID="66b7a1b1-01"
/dev/mapper/rhel-root: UUID="47528888-6441-4e77-ab90-ca520302d124" TYPE="xfs"
/dev/sda5: PARTUUID="c2529b75-05"
/dev/sda1: PARTUUID="c2529b75-01"
[root@localhost ~]# mkfs.ext4 /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 0533ce3b-4862-4b19-b039-a5d078cc9861
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]# blkid
/dev/mapper/rhel-swap: UUID="c2b8e15c-8163-497b-a499-104fa577ea65" TYPE="swap"
/dev/nvme0n1p3: UUID="7h4Y8b-0jNh-0O3L-XH0W-YjnC-IneO-OKqET1" TYPE="LVM2_member" PARTUUID="50efc439-f349-4fa1-af72-fa59ee50b9c6"
/dev/nvme0n1p1: UUID="05B5-4150" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0eaddf46-c79b-459e-b993-ca63711c3bbb"
/dev/nvme0n1p2: UUID="553c905e-0820-4a51-82f7-ad3dd487d627" TYPE="xfs" PARTUUID="3405594d-0416-4f13-b586-2bf3c4a6698d"
/dev/sdb2: UUID="6f3b0973-6c3f-4b2f-a43f-bae9bf92da42" TYPE="ext3" PARTUUID="812a1003-02"
/dev/sdb1: UUID="1bd6560c-0630-433a-947b-131f1d45fc55" TYPE="ext2" PARTUUID="812a1003-01"
/dev/sr0: UUID="2023-10-25-09-17-25-00" LABEL="RHEL-9-3-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="ece57f7f" PTTYPE="dos"
/dev/nvme0n2p1: UUID="15dbb67c-4d62-45f0-ab0c-d200c4127801" TYPE="xfs" PARTUUID="66b7a1b1-01"
/dev/mapper/rhel-root: UUID="47528888-6441-4e77-ab90-ca520302d124" TYPE="xfs"
/dev/sda5: PARTUUID="c2529b75-05"
/dev/sda1: UUID="0533ce3b-4862-4b19-b039-a5d078cc9861" TYPE="ext4" PARTUUID="c2529b75-01"
[root@localhost ~]# mkdir /guazai3
[root@localhost ~]# mount /dev/sda1 /guazai3
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 10G 0 disk
├─/dev/sda1 8:1 0 2G 0 part /guazai3
├─/dev/sda2 8:2 0 1K 0 part
└─/dev/sda5 8:5 0 6G 0 part
/dev/sdb 8:16 0 5G 0 disk
├─/dev/sdb1 8:17 0 2G 0 part
└─/dev/sdb2 8:18 0 1G 0 part
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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 15G 0 disk
└─/dev/nvme0n2p1 259:5 0 3G 0 part
[root@localhost ~]# echo this is 3 > /guazai3/3.txt
[root@localhost ~]# cat /guazai3/3.txt
this is 3.txt
[root@localhost ~]# mkfs.xfs /dev/sda5
meta-data=/dev/sda5 isize=512 agcount=4, agsize=393152 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=1572608, 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@localhost ~]# blkid
/dev/mapper/rhel-swap: UUID="c2b8e15c-8163-497b-a499-104fa577ea65" TYPE="swap"
/dev/nvme0n1p3: UUID="7h4Y8b-0jNh-0O3L-XH0W-YjnC-IneO-OKqET1" TYPE="LVM2_member" PARTUUID="50efc439-f349-4fa1-af72-fa59ee50b9c6"
/dev/nvme0n1p1: UUID="05B5-4150" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0eaddf46-c79b-459e-b993-ca63711c3bbb"
/dev/nvme0n1p2: UUID="553c905e-0820-4a51-82f7-ad3dd487d627" TYPE="xfs" PARTUUID="3405594d-0416-4f13-b586-2bf3c4a6698d"
/dev/sdb2: UUID="6f3b0973-6c3f-4b2f-a43f-bae9bf92da42" TYPE="ext3" PARTUUID="812a1003-02"
/dev/sdb1: UUID="1bd6560c-0630-433a-947b-131f1d45fc55" TYPE="ext2" PARTUUID="812a1003-01"
/dev/sr0: UUID="2023-10-25-09-17-25-00" LABEL="RHEL-9-3-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="ece57f7f" PTTYPE="dos"
/dev/nvme0n2p1: UUID="15dbb67c-4d62-45f0-ab0c-d200c4127801" TYPE="xfs" PARTUUID="66b7a1b1-01"
/dev/mapper/rhel-root: UUID="47528888-6441-4e77-ab90-ca520302d124" TYPE="xfs"
/dev/sda1: UUID="0533ce3b-4862-4b19-b039-a5d078cc9861" TYPE="ext4" PARTUUID="c2529b75-01"
/dev/sda5: UUID="4a388ad3-012f-4b80-930d-c5bf4f1c743b" TYPE="xfs" PARTUUID="c2529b75-05"
[root@localhost ~]# mkdir /guazai4
[root@localhost ~]# mount /dev/sda5 /guazai4
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 10G 0 disk
├─/dev/sda1 8:1 0 2G 0 part /guazai3
├─/dev/sda2 8:2 0 1K 0 part
└─/dev/sda5 8:5 0 6G 0 part /guazai4
/dev/sdb 8:16 0 5G 0 disk
├─/dev/sdb1 8:17 0 2G 0 part
└─/dev/sdb2 8:18 0 1G 0 part
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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 15G 0 disk
└─/dev/nvme0n2p1 259:5 0 3G 0 part
[root@localhost ~]# echo this is 4 > /guazai4/4.txt
[root@localhost ~]# cat /guazai4/4.txt
this is 4.txt
三.第三块硬盘
//进行磁盘分区
[root@localhost ~]# 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.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x66b7a1b1.
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-31457279, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31457279, default 31457279): +3g
Created a new partition 1 of type 'Linux' and of size 3 GiB.
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: dos
Disk identifier: 0x66b7a1b1
Device Boot Start End Sectors Size Id Type
/dev/nvme0n2p1 2048 6293503 6291456 3G 83 Linux
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
//创建文件系统(xfs类型)
[root@localhost ~]# mkfs.xfs /dev/nvm0n2p1
Error accessing specified device /dev/nvm0n2p1: No such file or directory
Usage: mkfs.xfs
/* blocksize */ [-b size=num]
/* config file */ [-c options=xxx]
/* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,
inobtcount=0|1,bigtime=0|1]
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,
(sunit=value,swidth=value|su=num,sw=num|noalign),
sectsize=num
/* force overwrite */ [-f]
/* inode size */ [-i perblock=n|size=num,maxpct=n,attr=0|1|2,
projid32bit=0|1,sparse=0|1,nrext64=0|1]
/* no discard */ [-K]
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n
sunit=value|su=num,sectsize=num,lazy-count=0|1]
/* label */ [-L label (maximum 12 characters)]
/* naming */ [-n size=num,version=2|ci,ftype=0|1]
/* no-op info only */ [-N]
/* prototype file */ [-p fname]
/* quiet */ [-q]
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]
/* sectorsize */ [-s size=num]
/* version */ [-V]
devicename
<devicename> is required unless -d name=xxx is given.
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
<value> is xxx (512 byte blocks).
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 10G 0 disk
├─/dev/sda1 8:1 0 1G 0 part
└─/dev/sda2 8:2 0 1K 0 part
/dev/sdb 8:16 0 5G 0 disk
├─/dev/sdb1 8:17 0 2G 0 part
└─/dev/sdb2 8:18 0 1G 0 part
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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 15G 0 disk
└─/dev/nvme0n2p1 259:5 0 3G 0 part
[root@localhost ~]# mkfs.xfs /dev/nvme0n2p1
meta-data=/dev/nvme0n2p1 isize=512 agcount=4, agsize=196608 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=786432, 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@localhost ~]# blkid
/dev/mapper/rhel-swap: UUID="c2b8e15c-8163-497b-a499-104fa577ea65" TYPE="swap"
/dev/nvme0n1p3: UUID="7h4Y8b-0jNh-0O3L-XH0W-YjnC-IneO-OKqET1" TYPE="LVM2_member" PARTUUID="50efc439-f349-4fa1-af72-fa59ee50b9c6"
/dev/nvme0n1p1: UUID="05B5-4150" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0eaddf46-c79b-459e-b993-ca63711c3bbb"
/dev/nvme0n1p2: UUID="553c905e-0820-4a51-82f7-ad3dd487d627" TYPE="xfs" PARTUUID="3405594d-0416-4f13-b586-2bf3c4a6698d"
/dev/sdb2: UUID="6f3b0973-6c3f-4b2f-a43f-bae9bf92da42" TYPE="ext3" PARTUUID="812a1003-02"
/dev/sdb1: UUID="1bd6560c-0630-433a-947b-131f1d45fc55" TYPE="ext2" PARTUUID="812a1003-01"
/dev/sr0: UUID="2023-10-25-09-17-25-00" LABEL="RHEL-9-3-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="ece57f7f" PTTYPE="dos"
/dev/nvme0n2p1: UUID="15dbb67c-4d62-45f0-ab0c-d200c4127801" TYPE="xfs" PARTUUID="66b7a1b1-01"
/dev/mapper/rhel-root: UUID="47528888-6441-4e77-ab90-ca520302d124" TYPE="xfs"
/dev/sda1: PARTUUID="b9069054-01"
[root@localhost ~]# mkdir /guazai5
[root@localhost ~]# echo this is 5 /guazai5/5.txt
this is 5 /guazai5/5.txt
[root@localhost ~]# echo 'this is 5' /guazai5/5.txt
this is 5 /guazai5/5.txt
[root@localhost ~]# mount /dev/nvme0n2p1 /guazai5
[root@localhost ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/sda 8:0 0 10G 0 disk
├─/dev/sda1 8:1 0 1G 0 part
└─/dev/sda2 8:2 0 1K 0 part
/dev/sdb 8:16 0 5G 0 disk
├─/dev/sdb1 8:17 0 2G 0 part
└─/dev/sdb2 8:18 0 1G 0 part
/dev/sr0 11:0 1 9.8G 0 rom /run/media/root/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 15G 0 disk
└─/dev/nvme0n2p1 259:5 0 3G 0 part /guazai5
[root@localhost ~]# echo this is 5 > /guazai5/5.txt
[root@localhost ~]# cat /guazai5/5.txt
this is 5.txt
至此实验完成