RHCSA第八天总结与练习

在这里插入图片描述

1、基本存储配置
1) 添加一块10G大小的磁盘,将该磁盘分为两个主分区,大小为1G、2G。将剩余的空间全部划分为扩展分区。划分一个逻辑分区,大小为3G。(主分区文件系统类型ext4,逻辑分区文件系统类型为xfs)

对nvme0n1进行分区操作

[root@localhost ~]# fdisk /dev/nvme0n2

创建第一个主分区

创建新分区
Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)

创建主分区,选p为主分区
Select (default p): p     
选择分区号,1表示第一个主分区
Partition number (1-4, default 1): 1
设置第一个主分区为1G的大小
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +1g

在这里插入图片描述
创建第二个主分区
在这里插入图片描述
创建扩展分区

创建扩展分区选e,其余步骤跟上面一致
Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): e

在这里插入图片描述
创建逻辑分区
在这里插入图片描述

最后选择w保存退出
在这里插入图片描述
进行格式化

[root@localhost ~]# mkfs.ext4 /dev/nvme0n2p1
[root@localhost ~]# mkfs.ext4 /dev/nvme0n2p2
[root@localhost ~]# mkfs.xfs /dev/nvme0n2p5

在这里插入图片描述
在这里插入图片描述
查看文件系统类型

[root@localhost ~]# blkid

在这里插入图片描述

2) 将三个分区分别挂载到/dir1、/dir2、/dir3。
创建挂载点目录

[root@localhost ~]# mkdir /dir{1..3} -p

在这里插入图片描述
挂载分区

[root@localhost ~]# mount /dev/nvme0n2p1 /dir1
[root@localhost ~]# mount /dev/nvme0n2p2 /dir2
[root@localhost ~]# mount /dev/nvme0n2p5 /dir3

3) 在第一个主分区中创建一个文件为file1,内容为this is partition1。在第二个分区中创建一个文件为file2,内容为this is partition2。在第三个分区中创建一个文件为file3,内容为this is partition3。

写入信息

[root@localhost /]# echo "this is partition1" > /dir1/file1
[root@localhost /]# echo "this is partition2" > /dir2/file2
[root@localhost /]# echo "this is partition3" > /dir3/file3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值