2025-01-15

屏幕截图 2025-01-15 155656.png

[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
sr0 11:0 1 11G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 18.4G 0 part
├─rhel-root 253:0 0 16.4G 0 lvm /
└─rhel-swap 253:1 0 2G 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 0xbb794151.

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):
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): +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):
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): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 4G 0 part
sr0 11:0 1 11G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 18.4G 0 part
├─rhel-root 253:0 0 16.4G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
[root@localhost ~]# mkfs.ext4 /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 85221d5c-0ac6-42d3-af0d-4fb5365f4820
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 ~]# 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@localhost ~]# mkdir /guazai3
[root@localhost ~]# mkdir /guazai4
[root@localhost ~]# mount /dev/sda1 /guazai3
[root@localhost ~]# mount /dev/sda5 /guazai4
[root@localhost ~]# echo "this is 3.txt" > /guazai3/3.txt
[root@localhost ~]# echo "this is 4.txt" > /guazai4/4.txt
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /guazai3
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 4G 0 part /guazai4
sr0 11:0 1 11G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 18.4G 0 part
├─rhel-root 253:0 0 16.4G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
3
using rhc at https://red.ht/registration
Last login: Wed Jan 15 16:55:06 2025 from 192.168.157.1
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 11G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 18.4G 0 part
├─rhel-root 253:0 0 16.4G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 15G 0 disk
[root@localhost ~]# gdisk /dev/nvme0n2
GPT fdisk (gdisk) version 1.0.7

Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present

Creating new GPT entries in memory.

Command (? for help): n
Partition number (1-128, default 1):
First sector (34-31457246, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-31457246, default = 31457246) or {+-}size{KMGTP}: +5g
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): ^C
[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 0x933a305d.

Command (m for help): g
Created a new GPT disklabel (GUID: 96CB61C0-28F3-7148-B83D-0481EED2AFFA).

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): +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.

[root@localhost ~]# mkfs.xfs /dev/nvme0n2
mkfs.xfs: /dev/nvme0n2 appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.
[root@localhost ~]# mkdir /guazai5
[root@localhost ~]# mount /dev/nvme0n2/guazai5
mount: /dev/nvme0n2/guazai5: can't find in /etc/fstab.
[root@localhost ~]# echo "this is 5.txt" > /sguazai/5.txt
-bash: /sguazai/5.txt: No such file or directory
[root@localhost ~]# lasblk
bash: lasblk: command not found...
[root@localhost ~]# echo "this is 5.txt" > /sguazai5/5.txt
-bash: /sguazai5/5.txt: No such file or directory
[root@localhost ~]# echo "this is 5.txt" > /guazai5/5.txt
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 11G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 18.4G 0 part
├─rhel-root 253:0 0 16.4G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 15G 0 disk
└─nvme0n2p1 259:6 0 5G 0 part

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1、添加三块硬盘: (1)第一块硬盘,虚拟磁盘类型选择SCSI。大小选择5G。按mbr格式分区。分两个主分区,大小...
    小饼子_7443阅读 472评论 0 1
  • 一、 第一块硬盘,虚拟磁盘类型选择SCSI。大小选择5G。按mbr格式分区。分两个主分区,大小分别为2G和 3G。...
    CC言堇阅读 38评论 0 0
  • 一, 定时任务 crontab -e 定时任务编写crontab -l 查看定时任务##以同步系统时间为例cr...
    慕知阅读 4,077评论 0 0
  • https://blog.csdn.net/a1809032425/article/details/7969203...
    _zhouj阅读 4,344评论 0 0
  • 配置分区大小 根据前面介绍的分区命令就可以创建分区了,不过需要注意,我们要为某些特定挂载点设置合适的分区大小。Ce...
    rosy_dawn阅读 9,003评论 0 0

友情链接更多精彩内容