磁盘管理
一、基本存储配置
1) 添加一块10G大小的磁盘,将该磁盘分为两个主分区,大小为1G、2G。将剩余的空间全部划分为扩展分区。划分一个逻辑分区,大小为3G。(主分区文件系统类型为ext4,逻辑分区文件系统类型为xfs)
[root@localhost ~]
创建新分区
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 ~]
[root@localhost ~]
[root@localhost ~]
2) 将三个分区分别挂载到/dir1、/dir2、/dir3。
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
3) 在第一个主分区中创建一个文件为file1,内容为this is partition1。在第二个分区中创建一个文 件为file2,内容为this is partition2。在第三个分区中创建一个文件为file3,内容为this ispartition3。
[root@localhost /]
[root@localhost /]
[root@localhost /]
二、总结