Disk quotas in freebsd

The quotas used to restrict the disk space for system users. It will be useful in case if you have not enough free disk space on your server and etc.

The quotas may be used by two ways:

# User quotas
# Group quotas

First of all you should rebuild your kernel with following option:

option QUOTA

In case if you using the GENERIC kernel you may omit this step because your kernel already contains this option.

Now you should edit the /etc/fstab:

Example: /dev/wd0a / ffs rw,userquota=/var/quotas/quota.user 1 1

To setup the quotas run the following command:

# edquota ericj (ericj – username or group name)

As result we will see the following information:

Quotas for user ericj:
/: blocks in use: 62, limits (soft = 0, hard = 0)
inodes in use: 25, limits (soft = 0, hard = 0)

Change tthis lines as displayed below to set up the limits:

Quotas for user ericj:
/: blocks in use: 62, limits (soft = 1000, hard = 1050)
inodes in use: 25, limits (soft = 0, hard = 0)

To activate this quotas:

# quotaon -a

Now we can see the active quota information by using the following command:

# quota ericj
Disk quotas for user ericj (uid 1001):

Filesystem blocks quota limit grace files quota limit grace

/ 62 1000 1050 27 0 0

To deactivate the quotas use:

# quotaoff -a

Dette indlæg blev udgivet i FreeBSD, Knowledge Base, Old Base. Bogmærk permalinket.

Skriv et svar