IBM Support

Setting Up and Using JFS2 Filesystem Quotas

Question & Answer


Question

How do I set up and manage quotas on a JFS2 filesystem?

Answer

Enable quotas on an existing JFS2 filesystem, or create a new filesystem with quotas enabled.

1. To change an existing filesystem:
# chfs -a quota=userquota /myfs
The other option is quota=groupquota, or both can be added

2. mount the filesystem
# mount /myfs

3. Make sure it mounted with quotas enabled:
# lsfs -q /myfs
Name            Nodename   Mount Pt           VFS   Size    Options    Auto Accounting
/dev/fslv02     --         /myfs              jfs2  2097152 rw         no   no
  (lv size: 2097152, fs size: 2097152, block size: 4096, sparse files: yes, inline log: no, inline log size: 0, EAformat: v1, Quota: userquota, DMAPI: no, VIX: no)


Set up a new class of quota limits for users

First, set up your EDITOR environment variable. This will allow you to modify or create a class.
If you want to use the "vi" editor, set it for:

# export EDITOR=/usr/bin/vi

If you have another editor you have installed in AIX and prefer to use that, set up the EDITOR environment variable to the path for that editor.

# j2edlimit -e /myfs

This will load the current quota class into your editor session to allow you to modify or add a limits class.

(If you wish to edit a group limit class use the "-g" flag to the j2edlimit command instead of "-e")

User Limits Classes for file system /myfs
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

Add a new class by creating a new line, using ID=+ and setting your limits:

+      1g           2g             12000     15000       7d       7d

Save the file and exit the editor.

The command should assign ID 1 to your new class, and list it out for you after the editor session. You can also list it using:

# j2edlimit -l /myfs
User Limits Classes for file system /myfs
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      1g           2g             12000     15000       7d       7d


Assign a user to your new limits class

# j2edlimit -a 1 -u bob /myfs
Where: 1 is the ID of the class you wish to assign
bob is the username


To report on a user's quota usage in a filesystem

# repquota /myfs
                           Block limits                       File limits
Group             used     soft     hard    grace    used     soft     hard    grace
system     --       64        0        0                4        0        0  
staff      --    18756        0        0                1        0        0  

                           Block limits                       File limits
User              used     soft     hard    grace    used     soft     hard    grace
root       --       32        0        0                4        0        0  
bob        --    18756  1048576  2097152                1    12000    15000  


To remove a user from a particular class

Reassign that user to class 0, which is unlimited.

# j2edlimit -a 0 bob /myfs
User Limits Classes for file system /myfs
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

Notice bob is not listed any more

[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"File management","Platform":[{"code":"PF002","label":"AIX"}],"Version":"5.3;6.1;7.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
17 June 2018

UID

isg3T1010969