Skip to content

Commit e104f2c

Browse files
authored
Merge pull request #186 from pelican-dev/advanced_configs_quotas
Add Quota Documentation
2 parents ceb516f + a4eabb7 commit e104f2c

File tree

8 files changed

+273
-9
lines changed

8 files changed

+273
-9
lines changed

docs/guides/disk-quotas/about.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Admonition from '@theme/Admonition';
2+
import Link from '@docusaurus/Link';
3+
4+
# About Quotas
5+
6+
<Admonition type="tip">
7+
As called out in the Wings install docs, it is always recommended to keep the server files on a separate partition.
8+
</Admonition>
9+
10+
## There are a lot of notices here for a reason!
11+
12+
<Admonition type="danger">
13+
Support for disk quotas is still being worked on!
14+
</Admonition>
15+
16+
<Admonition type="warning">
17+
These are advanced configurations meant for hosts but "should" work for individuals as well.
18+
</Admonition>
19+
20+
<Admonition type="warning">
21+
Depending on the filesystem Quotas can be difficult to enable for the `/` mount, which requires booting a live disk to change.
22+
</Admonition>
23+
24+
<Admonition type="info">
25+
You can either make a new mount with quotas enabled or enable quotas on an existing partition.
26+
</Admonition>
27+
28+
## Filesystem-specific docs
29+
<Link to="/docs/guides/disk-quotas/ext4-xfs">EXT4/XFS</Link>

docs/guides/disk-quotas/btrfs.mdx

Whitespace-only changes.
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
import Admonition from '@theme/Admonition';
2+
import Tabs from '@theme/Tabs';
3+
import TabItem from '@theme/TabItem';
4+
import Link from '@docusaurus/Link';
5+
6+
# EXT4 and XFS
7+
8+
This page covers disk quota management for EXT4/XFS.
9+
10+
Both EXT4 and XFS use the built-in quota management services in linux.
11+
12+
<Admonition type="warning">
13+
Please read <Link to="/docs/guides/disk-quotas/about">About Quotas</Link> before continuing
14+
</Admonition>
15+
16+
## Configure Filesystem
17+
How to format and mount a device for use with quotas
18+
19+
<details>
20+
<summary>I understand the risks and Pelican is not Liable for anything that breaks</summary>
21+
22+
<Admonition type="warning">
23+
Enabling quotas for `/` is difficult, as it requires booting a live disk to change.
24+
25+
We do not recommended this!
26+
</Admonition>
27+
28+
These examples use the following:
29+
`/dev/sdb` as the device formatted as EXT4 enabling only project quotas.
30+
`/var/lib/pelican/volumes/` as the mount point and data directory
31+
32+
<Tabs>
33+
<TabItem value='New EXT4 Filesystem'>
34+
## Format Device
35+
`mkfs.ext4` will format the disk with the ext4 filesystem
36+
* The `O` flag is the enable Feature Options
37+
- enable quotas while formatting
38+
* The `E` flag is for Extended Options
39+
- set the quota type as project
40+
```bash
41+
mkfs.ext4 -O quota -E quotatype=prjquota /dev/sdb
42+
```
43+
44+
<Admonition type="warning">
45+
You need to update fstab so the disk mounts automatically on boot with quotas enabled.
46+
</Admonition>
47+
48+
## Add to fstab
49+
### get device UUID
50+
The disk UUID is the best option for mounting the correct device via fstab.
51+
```bash
52+
lsblk /dev/sdb -no UUID
53+
# example output
54+
6c3b1734-3db4-4368-9bee-58651731b206
55+
```
56+
57+
### add new mount to fstab
58+
```shell title="/etc/fstab" {4}
59+
# <file system> <mount point> <type> <options> <dump> <pass>
60+
# / was on /dev/sda1 during installation
61+
UUID=8529a07b-28bc-4296-848a-a185aaf11e94 / ext4 errors=remount-ro 0 1
62+
UUID=6c3b1734-3db4-4368-9bee-58651731b206 /var/lib/pelican/volumes/ ext4 defaults,prjquota 0 1
63+
```
64+
For more information on fstab check the [Arch Linux fstab docs](https://wiki.archlinux.org/title/Fstab)
65+
66+
<Admonition type="warning">
67+
Depending on the OS you may need to refresh services to be able to mount the partition after updating `fstab`.
68+
69+
It is often easier to reboot and have the disk mount on boot.
70+
</Admonition>
71+
</TabItem>
72+
<TabItem value='Existing EXT4 Filesystem'>
73+
## Update existing partition
74+
Get the disk device path and uuid for your partition
75+
76+
by default `findmnt` lists all mounts on the system and lists their source, fstype, and options
77+
* The `n` flag disables headers
78+
* The `o` flag only returns specified values
79+
- `SOURCE` is device path
80+
- `UUID` is the device id
81+
```bash
82+
findmnt /var/lib/pelican/volumes -no SOURCE,UUID
83+
## example response
84+
/dev/sdb 6c3b1734-3db4-4368-9bee-58651731b206
85+
```
86+
87+
## Unmount disk
88+
Use `umount` to unmount Pelican's volume mount.
89+
```bash
90+
umount /var/lib/pelican/volumes/
91+
```
92+
93+
## Enable quotas
94+
<Admonition type="warning">
95+
This can only be ran on an unmounted disk
96+
</Admonition>
97+
`tune2fs` is used to adjust tunable file system parameters for EXT filesystems
98+
* The `Q` flag is to manage quotas
99+
- `prjquota` is to enable project quotas
100+
* The device path is needed
101+
```bash
102+
tune2fs -Q prjquota /dev/sdb
103+
```
104+
105+
## update fstab entry
106+
add `prjquota` to the line for the mount
107+
from
108+
```shell title="/etc/fstab"
109+
UUID=6c3b1734-3db4-4368-9bee-58651731b206 /var/lib/pelican/volumes/ ext4 defaults 0 1
110+
```
111+
to
112+
```shell title="/etc/fstab"
113+
UUID=6c3b1734-3db4-4368-9bee-58651731b206 /var/lib/pelican/volumes/ ext4 defaults,prjquota 0 1
114+
```
115+
For more information on fstab check the [Arch Linux fstab docs](https://wiki.archlinux.org/title/Fstab)
116+
117+
<Admonition type="warning">
118+
Depending on the OS you may need to refresh services to be able to mount the partition after updating `fstab`.
119+
120+
It is often easier to reboot and have the disk mount on boot.
121+
</Admonition>
122+
</TabItem>
123+
</Tabs>
124+
</details>
125+
126+
## Advanced EXT4 Quota Management
127+
<Admonition type="danger">
128+
The following section is for manual management of quotas.
129+
</Admonition>
130+
131+
<details>
132+
<summary>I understand </summary>
133+
<Admonition type="danger">
134+
You should never need to go here, this is your last warning.
135+
</Admonition>
136+
<details>
137+
<summary>I agree and Pelican is not Liable for anything that breaks</summary>
138+
139+
## Manually Manage Quotas
140+
Limits for the servers are managed on a "project" level so they can be assigned per-directory.
141+
142+
### Add A New Project
143+
To add a new project 2 files must be edited.
144+
145+
First is the `projid` file which is formatted where each line is in the `project_name:project_id` format as seen below
146+
* Pelican will use the server UUID as the project name
147+
* Make sure the ID is not already being used.
148+
```shell title="/etc/projid"
149+
235844d3-9258-4846-bb04-bcff209ccf9a:1
150+
b91d5528-d53f-4586-8d5c-682027f74a36:2
151+
```
152+
153+
Second is the `projects` file which is formatted where each line is in the `project_id:path_to_directory` format as seen below
154+
```shell title="/etc/projects"
155+
1:/var/lib/pelican/volumes/235844d3-9258-4846-bb04-bcff209ccf9a
156+
2:/var/lib/pelican/volumes/b91d5528-d53f-4586-8d5c-682027f74a36
157+
```
158+
159+
### Set directory attributes
160+
The project attribute must be set on the directory to track quota usage.
161+
162+
The `chattr` command changes attribute for files and directories.
163+
* The `+` and `-` operators add or remove attributes
164+
- The `P` makes it so files and directories created in the directory will inherit the project id of the directory.
165+
- The project id and directory must match
166+
* The `p` flag is for the project id
167+
```bash
168+
chattr +P -p ${project_id} ${path_to_directory}
169+
```
170+
171+
Example:
172+
```bash
173+
chattr +P -p 1 /var/lib/pelican/volumes/235844d3-9258-4846-bb04-bcff209ccf9a
174+
```
175+
176+
### set quota limits
177+
The built in quota management uses blocks by default.
178+
* You can specify limits in bytes as well.
179+
180+
The `setquota` command sets the quota for any object that supports quotas.
181+
* The `P` flag sets the quota for a project
182+
- This can use the project `id` or `name`
183+
- The should be the server UUID as shown in the examples below
184+
* The soft limit would send a warning to a user
185+
- This is not used by Pelican and will be set to 0
186+
* The hard limit is set to the disk resource limit set in Pelican
187+
* Neither the block or inode/file grace sections will be used by Pelican.
188+
* The path for either the device or the mount point
189+
- `/dev/sdb/` or `/var/lib/pelican/volumes/`
190+
```bash
191+
setquota -P ${server_uuid} ${soft_limit} ${hard_limit} ${block_grace} ${inode_grace} ${path}
192+
```
193+
194+
Example:
195+
setting a hard limit, in Gigabytes
196+
```bash
197+
setquota -P 235844d3-9258-4846-bb04-bcff209ccf9a 0 10G 0 0 /var/lib/pelican/volumes/
198+
```
199+
200+
### get quota stats
201+
The `repquota` command will generate a report on the quotas for the specified device or mount path
202+
* The `P` flag will break down the report by project.
203+
- In this case it should be the server UUID that is the project name
204+
* The `--human-readable` flag sets the limits to be displayed in a human readable format. By default that is Megabytes
205+
- `=g,g` changes the output to be in Gigabytes (can be `k`, `g`, `m`, or `t`)
206+
207+
Example:
208+
```bash
209+
repquota -P --human-readable=g,g /var/lib/pelican/volumes/ # could also be /dev/sdb
210+
```
211+
212+
Example Output
213+
```shell
214+
Block limits File limits
215+
Project used soft hard grace used soft hard grace
216+
----------------------------------------------------------------------
217+
235844d3-9258-4846-bb04-bcff209ccf9 -- 3G 0G 5G 1g 0g 0g
218+
cdb26bbb-963d-44b1-8353-360243032b1 -- 2G 0G 2G 1g 0g 0g
219+
```
220+
221+
</details>
222+
</details>
223+
224+
<Admonition type="note">
225+
TODO: Add documentation specifically for XFS
226+
</Admonition>

docs/guides/disk-quotas/lvm.mdx

Whitespace-only changes.

docs/guides/disk-quotas/zfs.mdx

Whitespace-only changes.

docs/wings/install.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import Admonition from '@theme/Admonition';
66
This software will not work on Windows operating systems.
77
</Admonition>
88

9+
<Admonition type="tip">
10+
It is always recommended to keep the server files on a separate partition.
11+
This prevents the root partition from filling and causing the host to crash, potentially becoming unbootable.
12+
</Admonition>
13+
914
## Supported Systems
1015

1116
The following is a list of supported operating systems. Please be aware that this is not an exhaustive list,
@@ -83,7 +88,7 @@ Alternatively, you can click on the Auto Deploy Command button, copy the sh comm
8388
<Admonition type="warning" title="Using ssl?">
8489
If your Panel is using SSL, then Wings must also use SSL.
8590

86-
See [Creating SSL Certificates](./../guides/ssl) documentation page for how to create these certificates before continuing.
91+
See [Creating SSL Certificates](../guides/ssl) documentation page for how to create these certificates before continuing.
8792
</Admonition>
8893

8994
### Starting Wings

sidebars.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ const sidebars: SidebarsConfig = {
4545
'wings/update'
4646
],
4747
},
48-
{
49-
type: 'category',
50-
label: 'Eggs',
51-
items: [
52-
'eggs/creating-a-custom-egg',
53-
'eggs/creating-a-custom-yolk',
54-
],
55-
},
5648
{
5749
type: 'category',
5850
label: 'Guides',
@@ -64,6 +56,15 @@ const sidebars: SidebarsConfig = {
6456
'guides/database-hosts',
6557
'guides/change-panel-domain',
6658
'guides/uninstalling',
59+
60+
{
61+
type: 'category',
62+
label: 'Disk Quotas',
63+
items: [
64+
'guides/disk-quotas/about',
65+
'guides/disk-quotas/ext4-xfs',
66+
]
67+
}
6768
],
6869
},
6970
'troubleshooting',

src/css/custom.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
--ifm-color-info-lighter: rgb(186, 230, 253);
2020
--ifm-color-info-lightest: rgb(240, 249, 255);
2121

22+
--ifm-container-width-xl: 1600px;
23+
--ifm-container-width: 1280px;
24+
2225
--ifm-code-font-size: 95%;
2326
}
2427

0 commit comments

Comments
 (0)