XFS是扩展性高、高性能的文件系统。也是rhel7/centos7的默认文件系统。
XFS支持metadata journaling,这使其能从crash中更快速的恢复。
它也支持在挂载和活动的状态下进行碎片整理和扩容。
通过延迟分配,XFS 赢得了许多机会来优化写性能。
可通过工具xfsdump和xfsrestore来备份和恢复xfs文件系统,
xfsdump可使用dump级别来完成增量备份,还可通过size,subtree,inode flags来排除文件。
也支持user、group、project配额。
挂载xfs系统分区到指定目录,并通过参数uquota,gquota开启文件系统配额。
* 1、不需要手动执行quotacheck对XFS文件系统进行检查,它会在mount 的时候自动执行
* 2、不需要在xfs文件系统的根下生成quato文件
* 3、quota limit 不能在quota启用前设置
[[email protected] ~]# mkdir /lvquota
[[email protected] ~]# mount -o usrquota,gquota /dev/vg/lv_quota /lvquota/
[[email protected] ~]# chmod 777 /lvquota/
[[email protected] ~]# chmod o+t /lvquota/
[[email protected] ~]# mount | grep lv_quo
/dev/mapper/vg-lv_quota on /lvquota type xfs (rw,relatime,seclabel,attr2,inode64,usrquota,grpquota)
###############################################################################
使用xfs_quota命令来查看配额信息以及为用户和目录分配配额,并验证配额限制是否生效。
-x 专家模式
-c 管理员命令(info xfs_quota -- >> "ADMINISTRATOR COMMANDS 里面有所有的命令介绍方法" )
[[email protected] ~]# xfs_quota -x -c ‘report‘ /lvquota/
User quota on /lvquota (/dev/mapper/vg-lv_quota)
Blocks
User ID Used Soft Hard Warn/Grace
---------- --------------------------------------------------
root 0 0 0 00 [--------]
Group quota on /lvquota (/dev/mapper/vg-lv_quota)
Blocks
Group ID Used Soft Hard Warn/Grace
---------- --------------------------------------------------
root 0 0 0 00 [--------]
davis 25600 0 0 00 [--------]
[[email protected] ~]# xfs_quota -x -c ‘limit bsoft=20M bhard=25M davis‘ /lvquota/
[[email protected] ~]# xfs_quota -x -c ‘report‘ /lvquota/
User quota on /lvquota (/dev/mapper/vg-lv_quota)
Blocks
User ID Used Soft Hard Warn/Grace
---------- --------------------------------------------------
root 0 0 0 00 [--------]
davis 25600 20480 25600 00 [6 days]
Group quota on /lvquota (/dev/mapper/vg-lv_quota)
Blocks
Group ID Used Soft Hard Warn/Grace
---------- --------------------------------------------------
root 0 0 0 00 [--------]
davis 25600 0 0 00 [--------]
[[email protected] lvquota]$ ll
total 15360
-rw-rw-r--. 1 davis davis 15728640 Jan 6 09:36 davis.disk
[[email protected] lvquota]$ du -sh davis.disk
15M davis.disk
[[email protected] lvquota]$ dd if=/dev/zero of=davis.disk1 bs=1M count=15
dd: error writing ‘davis.disk1’: Disk quota exceeded
11+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0122207 s, 858 MB/s
[[email protected] lvquota]$ du -sh davis.disk1
10M davis.disk1
[[email protected] lvquota]$ xfs_quota
xfs_quota> help
df [-bir] [-hn] [-f file] -- show free and used counts for blocks and inodes
help [command] -- help for one or all commands
print -- list known mount points and projects
quit -- exit the program
quota [-bir] [-gpu] [-hnNv] [-f file] [id|name]... -- show usage and limits
Use ‘help commandname‘ for extended help.
xfs_quota> print
Filesystem Pathname
/ /dev/sda3
/xfs /dev/mapper/vg-lv_xfs
/boot /dev/sda1
/lvquota /dev/mapper/vg-lv_quota (uquota, gquota)
xfs_quota> quota -u davis
Disk quotas for User davis (3000)
Filesystem Blocks Quota Limit Warn/Time Mounted on
/dev/mapper/vg-lv_quota
25600 20480 25600 00 [6 days] /lvquota
xfs_quota>
查看xfs_quota的帮助文件档,可以看到一些相关的例子:
EXAMPLES
Enabling quota enforcement on an XFS filesystem (restrict a user to a
set amount of space).
# mount -o uquota /dev/xvm/home /home
# xfs_quota -x -c ‘limit bsoft=500m bhard=550m tanya‘ /home
# xfs_quota -x -c report /home
Enabling project quota on an XFS filesystem (restrict files in log file
directories to only using 1 gigabyte of space).
# mount -o prjquota /dev/xvm/var /var
# echo 42:/var/log >> /etc/projects
# echo logfiles:42 >> /etc/projid
# xfs_quota -x -c ‘project -s logfiles‘ /var
# xfs_quota -x -c ‘limit -p bhard=1g logfiles‘ /var
Same as above without a need for configuration files.
# rm -f /etc/projects /etc/projid
# mount -o prjquota /dev/xvm/var /var
# xfs_quota -x -c ‘project -s -p /var/log 42‘ /var
# xfs_quota -x -c ‘limit -p bhard=1g 42‘ /var