Linux入门:用户磁盘配额quota

您所在的位置:网站首页 linux查看用户配置文件命令 Linux入门:用户磁盘配额quota

Linux入门:用户磁盘配额quota

2023-10-09 05:20| 来源: 网络整理| 查看: 265

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    学习是一种态度,只要你有态度,学习将会是一种乐趣 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

用户磁盘配额(针对分区)

1、如果任何用户可以随意使用磁盘空间,也是一件很可怕的事情,磁盘被写满之后,各种应用也将无法运行,甚至启动。使硬盘空间被占满有很多种方法:dd if=/dev/zero方法,或者copy大量无用文件等等 2、用户的家目录(home)应该使用单独的分区,而不是在根(/)分区中。如果在根分区中,任何用户又有对自己家目录的所有操作权限,就很容易将根目录写满数据 3、所以需要使用将磁盘进行分区,然后对分区中不同用户划分不的配额

#usrquota、grpquota #用户配额、组配额 mount -o remount,usrquota /test #临时性操作:remount重新挂载,挂载过程设置usrquota,对test目录 vim /etc/fstab #长期性的保存,就需要修改fstab。在 #/test / ext4 defaults,usrquota 0 0 #其实和挂载其它硬盘一样,只是在defaults后添加用户配额(usrquota)或组配额(grpquota) #defaults处,添加usrquota quotacheck -cu #创建(-c)用户(-u)配额文件 #分在对应分区创建aquota.user或aquota.group文件 quotaon /test #开启test目录的配额功能 quotaoff /test #关闭test目录的配额功能 edquota 用户名 #调用vi进入编辑页面 #/dev/sda2 blocks soft hard inodes soft hard #block soft hard #空间大小,soft限制达到只是提示,还有宽限期 #inodes soft hard #文件数量 quota #查看用户配额使用情况 repquota /test #(管理员)查看test分区上的所有用户限额 附 [root@bogon ~]# quotacheck Bad number of arguments. Utility for checking and repairing quota files. quotacheck [-gucbfinvdmMR] [-F ] filesystem|-a -u, --user check user files -g, --group check group files -c, --create-files create new quota files -b, --backup create backups of old quota files -f, --force force check even if quotas are enabled -i, --interactive interactive mode -n, --use-first-dquot use the first copy of duplicated structure -v, --verbose print more information -d, --debug print even more messages -m, --no-remount do not remount filesystem read-only -M, --try-remount try remounting filesystem read-only, continue even if it fails -R, --exclude-root exclude root when checking all filesystems -F, --format=formatname check quota files of specific format -a, --all check all filesystems -h, --help display this message and exit -V, --version display version information and exit Bugs to [email protected] [root@bogon ~]# mount -h Usage: mount -V : print version mount -h : print this help mount : list mounted filesystems mount -l : idem, including volume labels So far the informational part. Next the mounting. The command is `mount [-t fstype] something somewhere'. Details found in /etc/fstab may be omitted. mount -a [-t|-O] ... : mount all stuff from /etc/fstab mount device : mount device at the known place mount directory : mount known device here mount -t type dev dir : ordinary mount command Note that one does not really mount a device, one mounts a filesystem (of the given type) found on the device. One can also mount an already visible directory tree elsewhere: mount --bind olddir newdir or move a subtree: mount --move olddir newdir One can change the type of mount containing the directory dir: mount --make-shared dir mount --make-slave dir mount --make-private dir mount --make-unbindable dir One can change the type of all the mounts in a mount subtree containing the directory dir: mount --make-rshared dir mount --make-rslave dir mount --make-rprivate dir mount --make-runbindable dir A device can be given by name, say /dev/hda1 or /dev/cdrom, or by label, using -L label or by uuid, using -U uuid . Other options: [-nfFrsvw] [-o options] [-p passwdfd]. For many more details, say man 8 mount .


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3