磁盘配额
创建一个分区9
[root@localhost ~]# fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1
* 1 2550 20482843+ 83 Linux
/dev/sda2
2551 4462 15358140 83 Linux
/dev/sda3
4463 4615 1228972+ 82 Linux swap / Solaris
/dev/sda4
4616 6527 15358140 5 Extended
/dev/sda5
4616 4628 104391 8e Linux LVM
/dev/sda6
4629 4641 104391 8e Linux LVM
/dev/sda7
4642 4654 104391 8e Linux LVM
/dev/sda8
4655 4667 104391 8e Linux LVM
/dev/sda9
4668 4674 56196 83 Linux
格式化
[root@xx xiao1]# mkfs -t ext3 /dev/sda9
挂载到xiao1
[root@xx xiao1]# mount -t ext3 -o usrquota,grpquota /dev/sda9 /xiao1
初始化磁盘配额库
[root@xx xiao1]# quotacheck -ucg /dev/sda9
查看
[root@xx xiao1]# ls /xiao1
aquota.group aquota.user lost+found
检测磁盘配额是否启动
[root@xx xiao1]# quotaon -p /xiao1
group quota on /ff (/dev/sde9) is off
user quota on /ff (/dev/sde9) is off
启动
[root@xx xiao1]# quotaon /xiao1
查看
[root@xx xiao1]# quotaon -p /xiao1
(停止的命令[root@localhost /]# quotaoff /xiao1)
group quota on /xiao1 (/dev/sda9) is on
user quota on /xiao1 (/dev/sda9) is on
设置磁盘配额
[root@xx xiao1]# edquota -u x2 /xiao1
Disk quotas for user x2 (uid 502):
Filesystem
blocks soft hard inodes soft hard
/dev/sda9
6 1000 1500 5 3 5
~
(用户x2的警告为1000字节
警用为1500字节
最大文件创建数为5 警告为3 禁用5)
测试
[root@xx xiao1]# su x2
切换到用户x2
创建文件
在五个后会提示
[x2@xx xiao1]$ touch sagasgdhsdh
sda9: write failed, user file limit reached.
touch: 无法触碰 “sagasgdhsdh”: 超出磁盘限额
完成!
修改期限(天)
[root@xx xiao1]# edquota –t
将x2的限制值复制给 账户
[root@xx xiao1]# edquota -p x2 -u x3
[root@xx xiao1]# edquota -p x2 -u x4
(x3,x4为账户)