1、创建分区:
fdisk /dev/sdd
n 创建分区
e 扩展分区
p 主分区
创建三个分区:83 etx4,82 swap,b fat
注:配置fat的分区空间不能小于80M,否则格式化报错:
[root@localhost /]# mkfs.vfat -F 32 /dev/sdd3
mkfs.fat 3.0.20 (12 Jun 2013)
WARNING: Not enough clusters for a 32 bit FAT!
2、格式化:
ext4类型
mkfs -t ext4 /dev/sdd1
swap类型
mkswap /dev/sdb2
swapon /dev/sdb2
fat类型
mkfs.vfat -F 32 /dev/sdd3
创建动态卷轴
1、创建物理卷:
[root@localhost ~]# pvcreate /dev/sde1 /dev/sde2
Physical volume “/dev/sde1” successfully created.
Physical volume “/dev/sde2” successfully created.
[root@localhost ~]# vgcreate etx4 /dev/sde1 /dev/sde2
Volume group “etx4” successfully created
[root@localhost ~]# lvcreate -L 10G -n etx etx4
Volume group “etx4” has insufficient free space (1021 extents): 2560 required. 报错的提示是英文PE的每个大小是4M,实际大小是20G,但是使用的空间是19G,全部分配,会提示,空间不足
[root@localhost ~]# lvcreate -L 1G -n etx etx4
Logical volume “etx” created.
格式化:mkfs.xfs /dev/etx4/etx
mkfs -t ext4 /dev/yu/yu01
挂载:mount /dev/etx4/etx /opt/etx4
2、磁盘配额管理quota:
/dev/etx4/etx /opt/etx4 ext4 defaults,usrquota,grpquota 0 0
关闭安全功能:
setenforce 0
创建配额配置文件:
quotacheck -cvug /dev/yu/yu01
-u、-g:检测用户、组配额
-c:创建配额数据文件
-v:显示执行过程信息
查看挂载点是否存在:
[root@localhost opt]# cd etx4/
[root@localhost etx4]# ls
aquota.group aquota.user lost+found,这两个文件存在,挂载点存在
对指定用户设置配额:
edquota -u testext
设置配额:
[root@localhost etx4]# edquota -u testext
Disk quotas for user testext (uid 1007):
Filesystem blocks soft hard inodes soft hard
/dev/sdb3 0 0 0 0 0 0
/dev/mapper/etx4-etx 0 100M 200M 0 4 5
开启配额:
[root@localhost opt]# quotaon -ugv /opt/etx4/
/dev/mapper/etx4-etx [/opt/etx4]: group quotas turned on
/dev/mapper/etx4-etx [/opt/etx4]: user quotas turned on
增加权限:
chmod 777 /yu01
切换用户:
su - testext
验证配额:
[testext@localhost etx4]$ dd if=/dev/zero of=yun.txt bs=100M count=6
dm-0: warning, user block quota exceeded.
dm-0: write failed, user block limit reached.
dd: error writing ‘yun.txt’: Disk quota exceeded
3+0 records in
2+0 records out
209715200 bytes (210 MB) copied, 0.186375 s, 1.1 GB/s
[testext@localhost etx4]$ touch {1,2,3,4,5}.txt
dm-0: warning, user file quota exceeded.
dm-0: write failed, user file limit reached.
touch: cannot touch ‘5.txt’: Disk quota exceeded