RHCSAday8-磁盘管理

磁盘管理

一、基本存储配置

1) 添加一块10G大小的磁盘,将该磁盘分为两个主分区,大小为1G、2G。将剩余的空间全部划分为扩展分区。划分一个逻辑分区,大小为3G。(主分区文件系统类型为ext4,逻辑分区文件系统类型为xfs)
[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

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

创建逻辑分区
Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   l   logical (number for 5)
Select (default p): l

Last sector, +sectors or +size{K,M,G,T,P} (2099220-20971519, default 20971519): +3g

最后w退出

[root@localhost ~]# mkfs.ext4 /dev/nvme0n2p1
[root@localhost ~]# mkfs.ext4 /dev/nvme0n2p2
[root@localhost ~]# mkfs.xfs /dev/nvme0n2p5
2) 将三个分区分别挂载到/dir1、/dir2、/dir3。
[root@localhost ~]# mkdir -p /dir{1..3}
[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 ispartition3。
[root@localhost /]# echo "this is partition1" > /dir1/file1
[root@localhost /]# echo "this is partition2" > /dir2/file2
[root@localhost /]# echo "this is partition3" > /dir3/file3

二、总结

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值