This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
openbsd:shell:quotas [2020/02/27 00:21] pirata |
openbsd:shell:quotas [2020/07/23 19:01] (current) jrmu |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Disk quotas ====== | ====== Disk quotas ====== | ||
Disk quotas are used to place limits on the amount of disk space available to certain users and groups. | Disk quotas are used to place limits on the amount of disk space available to certain users and groups. | ||
- | |||
There are two types of quotas - soft and hard quotas. | There are two types of quotas - soft and hard quotas. | ||
- | - **soft quotas** - once threshold is reached, warns the users and sets a grace period time so they can decrease their disk usage below limits. After the grace period is over, the soft limit is handled as a hard limit | + | - **soft quotas** - allows further disk allocation but, once threshold is reached, warns users and sets a grace period time so they can decrease their disk usage below limits. After the grace period is over, the soft limit is handled as a hard limit |
- | - **hard quotas** - does not allow any more disk allocation once threshold value is reached. | + | - **hard quotas** - does not allow any more disk allocation once threshold is reached. |
- | Currently, IRCNow's shell limits disk usage to **5GB** (soft) and **10GB** (hard) per user. | + | Currently, IRCNow's shell limits disk usage to **1GB** (soft) and **1.5GB** (hard) and users have 1 week to decrease disk usage. |
====== Setting up ====== | ====== Setting up ====== | ||
- | To enable quotas, We need to mark all the desired filesystems by adding the keywords **userquota** and/or **groupquota** in fstab(5) on which filesystem We want to be able to enforce quotas. By default, files **quota.user** and **quota.group** will be created at the root of those filesystems. | + | To enable quotas, We need to mark all the desired filesystems by adding the keywords **userquota** and/or **groupquota** in fstab(5) for each filesystem We want to be able to enforce quotas. |
<code bash> | <code bash> | ||
Line 16: | Line 15: | ||
</code> | </code> | ||
- | ====== Defining thresholds ====== | + | ====== Defining limits ====== |
- | To set thresholds, We use edquota(8). Keep in mind that values are measured in KB (1MB equals to 1000KB). | + | To set thresholds, We use edquota(8). Keep in mind that values are measured in KB (1000KB equals to 1MB). |
+ | |||
+ | edquota(8) invokes vi(1) unless you specify other editor. | ||
<code bash> | <code bash> | ||
Line 31: | Line 32: | ||
</code> | </code> | ||
- | On the first above, PiRATA can use up to 512MB on his $HOME. On the latter. all staff users are limited to 15GB of disk space. | + | On the first above, PiRATA can use up to 512MB on his $HOME. On the latter, all staff users are limited to 15GB of disk space. |
Now, what if you need to define a certain threshold for 7 or 8 users or even 50? What would you do? Probably you would use edquota(8) for each user. | Now, what if you need to define a certain threshold for 7 or 8 users or even 50? What would you do? Probably you would use edquota(8) for each user. | ||
- | Gladly, We don't need to - by invoking **-p** option followed by the user that all the other users will replicate from and then specify all users. | + | |
+ | Gladly, We don't need to - by invoking the **-p** option we can have the thresholds replicated: | ||
<code bash> | <code bash> | ||
- | $ edquota -p PiRATA jrmu jimmy_will dennis | + | $ edquota -p PiRATA jrmu jimmy_will dennis |
</code> | </code> | ||
+ | By invoking the **-t** option, grate time can be defined: | ||
+ | |||
+ | <code bash> | ||
+ | $ edquota -t search_social | ||
+ | Time units may be: days, hours, minutes, or seconds | ||
+ | Grace period before enforcing soft limits for users: | ||
+ | /home: block grace period: 7 days, file grace period: 7 days | ||
+ | </code> | ||
====== Enabling/Disabling quotas ====== | ====== Enabling/Disabling quotas ====== | ||
Line 52: | Line 62: | ||
</code> | </code> | ||
- | ====== Displaying limits ====== | + | ====== Displaying quota statistics ====== |
quota(1) outputs current disk usage and limits. By default, only the user quotas are printed but you can see group quotas by invoking **-g** option. | quota(1) outputs current disk usage and limits. By default, only the user quotas are printed but you can see group quotas by invoking **-g** option. | ||