加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_宿迁站长网 (https://www.0527zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Unix > 正文

磁盘配额的配置步骤

发布时间:2022-11-16 16:36:43 所属栏目:Unix 来源:未知
导读: [root@client67 ~]# vi /etc/fstab
[root@client67 ~]# head /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1 / ext3 defaults,usrquota,gr

[root@client67 ~]# vi /etc/fstab

[root@client67 ~]# head /etc/fstab

# This file is edited by fstab-sync - see 'man fstab-sync' for details

LABEL=/1 / ext3 defaults,usrquota,grpquo 1 1

LABEL=/boot1 /boot ext3 defaults 1 2

LABEL=/data /data ext3 defaults 1 2

none /dev/pts devpts gid=5,mode=620 0 0

none /dev/shm tmpfs defaults 0 0

none /proc proc defaults 0 0

none /sys sysfs defaults 0 0

LABEL=/u01 /u01 ext3 defaults 1 2

LABEL=SWAP-sda6 swap swap defaults 0 0

[root@client67 ~]# mount

/dev/sda5 on / type ext3 (rw)

none on /proc type proc (rw)

none on /sys type sysfs (rw)

none on /dev/pts type devpts (rw,gid=5,mode=620)

usbfs on /proc/bus/usb type usbfs (rw)

/dev/sda1 on /boot type ext3 (rw)

/dev/sda3 on /data type ext3 (rw)

none on /dev/shm type tmpfs (rw)

/dev/sda2 on /u01 type ext3 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

/proc on /var/named/chroot/proc type none (rwunix磁盘限额,bind)

/dev/sda7 on /media/sda7 type ext3 (rw)

[root@client67 ~]# mount -o remount /

[root@client67 ~]# mount |grep sda5

/dev/sda5 on / type ext3 (rw,usrquota,grpquota)

[root@client67 ~]# quotacheck -mcvugf /

quotacheck: Scanning /dev/sda5 [/] quotacheck: Cannot stat old user quota file: 没有那个文件或目录

quotacheck: Cannot stat old group quota file: 没有那个文件或目录

quotacheck: Cannot stat old user quota file: 没有那个文件或目录

quotacheck: Cannot stat old group quota file: 没有那个文件或目录

done

quotacheck: Checked 15796 directories and 118640 files

quotacheck: Old file not found.

quotacheck: Old file not found.

[root@client67 ~]# ls /

aquota.group boot etc lib misc proc selinux tftpboot usr

aquota.user data home lost+found mnt root srv tmp var

bin dev initrd media opt sbin sys u01

[root@client67 ~]# useradd abc

useradd: user abc exists

[root@client67 ~]# useradd xyz

[root@client67 ~]# edquota -u xyz

[root@client67 ~]#

[root@client67 ~]# quotaon /

[root@client67 ~]# quotastats

Kernel quota version: 6.5.1

Number of dquot lookups: 81

Number of dquot drops: 1

Number of dquot reads: 6

Number of dquot writes: 0

Number of quotafile syncs: 20

Number of dquot cache hits: 75

Number of allocated dquots: 6

Number of free dquots: 0

Number of in use dquot entries (user/group): 6

[root@client67 ~]# su - xyz

[xyz@client67 ~]$ whoami

xyz

[xyz@client67 ~]$ dd if=/dev/zero of=file1 bs=1024k count=1

sda5: warning, user block quota exceeded.

读入了 1+0 个块

输出了 1+0 个块

[xyz@client67 ~]$ quota

Disk quotas for user xyz (uid 8893):

Filesystem blocks quota limit grace files quota limit grace

/dev/sda5 1032* 1000 1500 7days 1 5 8

[xyz@client67 ~]$ touch a b c d e

sda5: warning, user file quota exceeded.

[xyz@client67 ~]$

[xyz@client67 ~]$ quota

Disk quotas for user xyz (uid 8893):

Filesystem blocks quota limit grace files quota limit grace

/dev/sda5 1052* 1000 1500 6days 6* 5 8 7days

[xyz@client67 ~]$ touch f g h i

sda5: write failed, user file limit reached.

touch: cannot touch ‘h’: 超出磁盘限额

touch: cannot touch ‘i’: 超出磁盘限额

[xyz@client67 ~]$ quota

Disk quotas for user xyz (uid 8893):

Filesystem blocks quota limit grace files quota limit grace

/dev/sda5 1060* 1000 1500 6days 8* 5 8

[xyz@client67 ~]$ ls

a b c d e f file1 g

[xyz@client67 ~]$ exit

logout

[root@client67 ~]# repquota

Bad number of arguments.

repquota: Utility for reporting quotas.

Usage:

repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] (-a | mntpoint)

Bugs to ,

[root@client67 ~]# repquota -a

*** Report for user quotas on device /dev/sda5

Block grace time: 7days; Inode grace time: 7days

Block limits File limits

User used soft hard grace used soft hard grace

----------------------------------------------------------------------

root -- 3225436 0 0 134168 0 0

daemon -- 20 0 0 3 0 0

lp -- 8 0 0 1 0 0

rpm -- 42940 0 0 111 0 0

netdump -- 16 0 0 2 0 0

rpcuser -- 8 0 0 1 0 0

smmsp -- 16 0 0 2 0 0

apache -- 24 0 0 3 0 0

squid -- 16 0 0 2 0 0

webalizer -- 32 0 0 4 0 0

xfs -- 4 0 0 1 0 0

ntp -- 16 0 0 2 0 0

htt -- 28 0 0 4 0 0

quagga -- 40 0 0 5 0 0

amanda -- 1096 0 0 58 0 0

named -- 112 0 0 14 0 0

ldap -- 8 0 0 1 0 0

gdlc -- 104 0 0 13 0 0

hesx -- 12 0 0 2 0 0

test -- 96 0 0 12 0 0

test2 -- 96 0 0 12 0 0

xyz ++ 1060 1000 1500 6days 8 5 8 6days

#500 -- 476 0 0 14 0 0

(编辑:云计算网_宿迁站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!