如何在Linux中设置目录大小限制? [英] How to set limit on directory size in Linux?
本文介绍了如何在Linux中设置目录大小限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经阅读了限制目录的大小 - 比如创建大文件,格式化,挂载等..
但是这一切都非常复杂。是否存在实用程序或其他设置限制已有的目录?
I have read about limiting size of directory - like creating big files, formatting,mount,.. etc. But this all very complicated. Does exist utility or something else to set limit on already existing directory?
推荐答案
配额是基于文件系统,但您可以始终创建一个虚拟文件系统,并将其安装在具有usrquota和/或grpquota标志的特定(空)目录中。
Quota is based upon filesystems, but you can always create a virtual filesystem and mount it on a specific (empty) directory with the usrquota and/or grpquota flags.
步骤如下:
- 创建挂载点
- 创建一个满载/ dev / zero的文件,足够大到要为虚拟文件系统预留的最大大小
- 使用ext3文件系统格式化此文件(您可以格式化磁盘空间,即使它不是块设备,但是仔细检查每个危险格式化命令的语法)
- 挂载在您创建的目录中新格式化的磁盘空间为安装点,例如
代码:
mount -o loop,rw,usrquota,grpquota / path / to / the / formatted / disk / space / path / of / mount / point
- 设置正确的权限
- 设置配额
,诀窍完成。
- create the mount point
- create a file full of /dev/zero, large enough to the maximum size you want to reserve for the virtual filesystem
- format this file with an ext3 filesystem (you can format a disk space even if it is not a block device, but double check the syntax of every - dangerous - formatting command)
- mount the newly formatted disk space in the directory you've created as mount point, e.g.
Code:
mount -o loop,rw,usrquota,grpquota /path/to/the/formatted/disk/space /path/of/mount/point
- Set proper permissions
- Set quotas and the trick is done.
这篇关于如何在Linux中设置目录大小限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文