1、创建一个10G的文件系统,类型为ext4,要求开机可自动挂载至单独数据/data目录;
(1)新建立一个分区
[[email protected] wuzhibin]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It‘s strongly recommended to
switch off the mode (command ‘c‘) and change display units to
sectors (command ‘u‘).
Command (m for help): n
(2)设置为主分区
Command action
e extended
p primary partition (1-4)
p
(3)设置为第3个主分区
Partition number (1-4): 3
(4)设置分区容量为10G
First cylinder (2811-26108, default 2811): 2811
Last cylinder, +cylinders or +size{K,M,G} (2811-26108, default 26108): +10G
(5)保存设置退出
Command (m for help): w
(6)使用partx -a命令激活新划分的分区,这样可以不用重新启动电脑
[r[email protected] wuzhibin]# partx -a /dev/sda
(7)格式化新分区为EXT4
[[email protected] wuzhibin]# mke2fs -t ext4 /dev/sda3
(8)建立/data目录
[[email protected] ~]# mkdir /data
(9)设置新分区的卷标为/data
[[email protected] ~]# e2label /dev/sda3 /data
(10)设置将新分区开机自动挂载至/data目录
[[email protected] ~]# vi /etc/fstab
将/dev/sda3 /data ext4 default 0 0添加到最后一行,保存退出即可完成开机自动挂载/data目录