Quota Management

root's picture

USE THESE COMMANDS AT YOUR OWN RISK. IF YOU DON'T UNDERSTAND WHAT THEY DO, DO NOT USE THEM AND GO TO THE MAN PAGES!

If you see difference between disk usage and user quota usage, you can correct this by executing quotacheck command.
Here you have an example:

[aix:root:/DATA2:] [color=blue]find . -xdev -user data2user -type f -exec du -k {} \;|awk '{ s = s+$1 } END { print "Total used: ",s }'[/color]
Total used:  157160496

[aix:root:/DATA2:] [color=blue]quota -v data2user[/color]
Disk quotas for user data2user (uid 314):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /DATA2 107431364   157286400 157286400              2777          0        0

[aix:root:/DATA2:] [color=blue]quotacheck -a[/color]		[color=green]<--* No output.[/color]
[aix:root:/DATA2:] [color=blue]quota data2user[/color]
Disk quotas for user data2user (uid 314):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /DATA2 168524412 * 157286400 157286400     none     2718          0        0

[aix:root:/DATA2:] [color=blue]find . -xdev -user data2user -type f -exec du -k {} \;|awk '{ s = s+$1 } END { print "Total used: ",s }'[/color]
Total used:  168872240

How to activate quota:

[aix:root:] [color=blue]quotaon[/color]

Report of quotas - command and example:

[aix:root:/home/root:] [color=blue]repquota -v -a[/color]
*** Report for user quotas on /DATA2 (/dev/DATA2_lv)
                           Block limits                         File limits
User              used     soft     hard    grace      used     soft     hard    grace
root       --     7472        0        0                291        0        0
datactlg    --    45944  4194304  4194304                 26        0        0
ndfuser    --  1389484        0        0                 14        0        0
dfuser      -- 106217316        0        0               7495        0        0
data2user    -- 146658300 178257920 178257920               2997        0        0
data        --      172        0        0                  2        0        0
dataadm     --  4406028        0        0              18510        0        0
datasrv     --    14372        0        0                 14        0        0

*** Report for user quotas on /DATA3 (/dev/DATA3_lv)
                           Block limits                         File limits
User              used     soft     hard    grace      used     soft     hard    grace
root       --  8264120        0        0                172        0        0
datactlg    --     2128 31457280 31457280                  1        0        0
bahadmin   --      240        0        0                  3        0        0
dfuser      -- 60980480        0        0                604        0        0
data        -- 12910952        0        0              67401        0        0
datasrv     --  1655400        0        0               1724        0        0
datademo    --   274672        0        0                293        0        0
globuser    --   831632        0        0                311        0        0

How to enable quota on a filesystem:

[aix:root:/home/root:] [color=blue]grep -p /DATA3 /etc/filesystems[/color]       [color=green]<--* checking if quota is enabled (looking for "quota" stanza)[/color]
/DATA3:
        dev             = /dev/DATA3_lv
        vfs             = jfs2
        log             = /dev/loglv03
        mount           = true
        options         = rw
        account         = false
[aix:root:/home/root:] [color=blue]chfs -a "quota = userquota" /DATA3[/color]        [color=green]<--* enable quota with chfs command[/color]
Initializing quota file /DATA3/quota.user
*** Checking user quotas for /dev/DATA3_lv (/DATA3)
root     fixed: inodes 0 -> 172 blocks 0 -> 8264120
datactlg  fixed: inodes 0 -> 1   blocks 0 -> 2128
bahadmin fixed: inodes 0 -> 3   blocks 0 -> 240
dfuser    fixed: inodes 0 -> 604 blocks 0 -> 60980480
data      fixed: inodes 0 -> 67401       blocks 8 -> 12910792
datasrv   fixed: inodes 0 -> 1724        blocks 0 -> 1655400
datademo  fixed: inodes 0 -> 293 blocks 0 -> 274672
globuser  fixed: inodes 0 -> 311 blocks 0 -> 831632
[aix:root:/home/root:] [color=blue]grep -p /DATA3 /etc/filesystems[/color]       [color=green]<--* checking again if quota is enabled[/color]
/DATA3:
        dev             = /dev/DATA3_lv
        vfs             = jfs2
        log             = /dev/loglv03
        mount           = true
        options         = rw
        account         = false
        quota           = userquota        [color=green]<--* "quota" stanza is listed now[/color]

To modify the user quota on a JFS2 fs, you must use j2edlimit command (for JFS you need to use edquota command)
Here you have example with JFS2 fs:

To list user quota for the filesystem:

[aix:root:/DATA2:] [color=blue]j2edlimit -l -u /DATA2[/color]
User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.

	Block Limits	File Limits	Grace Period
ID	soft	hard	soft	hard	block	file

0	0	0	0	0	0	0
1	150g	150g	0	0	0	0

To edit user quota for the filesystem:

[aix:root:/DATA2:] [color=blue]j2edlimit -e -u /DATA2[/color]
"/tmp/J2EdLim.dR7f7a" 12 lines, 589 characters				[color=green]<--* File will be opened in editor.[/color]
User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.
Prepend '-' to ID to delete Limits Class.
Use '+' for ID to add new Limits Class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      170g         170g           0         0           0        0	[color=green]<--*(edit from 150g to 170g quota, for example.)[/color]

:wq  [color=green]<--*(Save edit)[/color]

"/tmp/J2EdLim.dR7f7a" 12 lines, 589 characters
User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      170g         170g           0         0           0        0

Now, quota command will display the new value:

[aix:root:/DATA2:] [color=blue]quota data2user[/color]
Disk quotas for user data2user (uid 314):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /DATA2 163995432   178257920 178257920              2684          0        0

How to add another quota class to a filesystem:

[aix:root:/home/root:] [color=blue]j2edlimit -e -u /DATA2[/color]
"/tmp/J2EdLim.o-IdMa" 12 lines, 589 characters			[color=green]<--* File will be opened in editor.[/color]
User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.
Prepend '-' to ID to delete Limits Class.
Use '+' for ID to add new Limits Class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      170g         170g           0         0           0        0
+ 30g 30g 0 0 0 0 						[color=green]<--* add new quota class.[/color]
"/tmp/J2EdLim.o-IdMa" 13 lines, 608 characters
User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      170g         170g           0         0           0        0
2      30g          30g            0         0           0        0

How to add user to a specific quota class of a filesystem:

[aix:root:/home/root:] [color=blue]quota -v datactlg[/color]
Disk quotas for user datactlg (uid 204):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /DATA2    41748          0        0                21          0        0

[aix:root:/home/root:] [color=blue]j2edlimit -a 2 -u datactlg /DATA2[/color]	[color=green]<--* add class created above, desired user and of course filesystem[/color]
User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

2      30g          30g            0         0           0        0
[aix:root:/home/root:] [color=blue]quota -v datactlg[/color]
Disk quotas for user datactlg (uid 204):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /DATA2    41748   31457280 31457280                21          0        0

How to check group quota:

[aix:root:/home/root:] [color=blue]quota -g datamktg[/color]
Disk quotas for group sasmktg (gid 209):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /PMSASNDF 52428756   52428800 52428800               619          0        0

How to edit group quota for a filesystem:

[aix:root:/home/root:] [color=blue]j2edlimit -e -g /DATA2[/color]

User Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.
Prepend '-' to ID to delete Limits Class.
Use '+' for ID to add new Limits Class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      135g         135g           0         0           0        0
2      4g           4g             0         0           0        0
"/tmp/J2EdLim.aZYeEa" 13 lines, 665 characters     [color=green]<--* File will be opened in editor.[/color]
Group Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.
Prepend '-' to ID to delete Limits Class.
Use '+' for ID to add new Limits Class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      12g          12g            0         0           0        0
2      50g          50g            0         0           0        0       [color=green]<--*(edit from 50g to 100g quota, for example.)[/color]
:wq  [color=green]<--*(Save edit)[/color]
"/tmp/J2EdLim.aZYeEa" 13 lines, 666 characters

Group Limits Classes for file system /DATA2
Block Limits units: g=gigabyte, m=megabyte, or optional k=kilobyte
Grace Period units: d=days, h=hours, m=minutes, or s=seconds
Limits Class ID 0 is the default class.

       Block Limits                File Limits           Grace Period
ID     soft         hard           soft      hard        block    file

0      0            0              0         0           0        0
1      12g          12g            0         0           0        0
2      100g         100g           0         0           0        0
[aix:root:/home/root:] [color=blue]quota -g datamktg
[/color]
Disk quotas for group sasmktg (gid 209):
     Filesystem   blocks      quota    limit    grace    files      quota    limit    grace
      /PMSASNDF 52428756   104857600 104857600               619          0        0

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root