Skip to content

Commit 8910b48

Browse files
committed
docs: created 4 new docs for xfs quota
Signed-off-by: Bala Harish <[email protected]>
1 parent 5f3f015 commit 8910b48

File tree

6 files changed

+690
-0
lines changed

6 files changed

+690
-0
lines changed

docs/i18n/en/docusaurus-plugin-content-docs/version-4.1.x.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,9 @@
9090
"sidebar.docs.category.Support": {
9191
"message": "Support",
9292
"description": "The label for category Support in sidebar docs"
93+
},
94+
"sidebar.docs.category.Backup and Restore": {
95+
"message": "Backup and Restore",
96+
"description": "The label for category Backup and Restore in sidebar docs"
9397
}
9498
}
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
id: enable-xfs-quota
3+
title: Enable XFS Quota on LocalPV Hostpath
4+
keywords:
5+
- OpenEBS LocalPV Hostpath Enable XFS Quota
6+
- XFS Quota
7+
- Enable XFS Quota
8+
- Advanced Operations
9+
description: This section talks about enabling XFS quotas for OpenEBS LocalPV Hostpath.
10+
---
11+
12+
# Enable XFS Quota on LocalPV Hostpath
13+
14+
This document provides the necessary steps to enable and configure XFS Quota on OpenEBS LocalPV HostPath. By following these instructions, you will install the OpenEBS LocalPV provisioner, create a StorageClass with XFS Quota support, and set up a PersistentVolumeClaim (PVC) to apply project quotas on the local volumes. It also includes the process for mounting the volume to an application pod and verifying that the quota is successfully applied.
15+
16+
## Install the OpenEBS Dynamic LocalPV Provisioner
17+
18+
1. To install the OpenEBS LocalPV Hostpath Provisioner, execute the following command:
19+
20+
```
21+
kubectl apply -f https://openebs.github.io/charts/openebs-operator-lite.yaml
22+
```
23+
24+
2. Verify the pods in the `openebs` namespace are running.
25+
26+
```
27+
kubectl get pods -n openebs
28+
```
29+
30+
**Example Output**
31+
32+
```
33+
NAME READY STATUS RESTARTS AGE
34+
openebs-localpv-provisioner-6ddbd95d4d-htp7g 1/1 Running 0 7m12s
35+
```
36+
37+
## Create StorageClass
38+
39+
1. To create a hostpath StorageClass with the XFSQuota configuration option, use the following YAML definition. This configuration will enable the XFSQuota for the specified path and storage type.
40+
41+
```
42+
apiVersion: storage.k8s.io/v1
43+
kind: StorageClass
44+
metadata:
45+
name: openebs-hostpath-xfs
46+
annotations:
47+
openebs.io/cas-type: local
48+
cas.openebs.io/config: |
49+
- name: StorageType
50+
value: "hostpath"
51+
- name: BasePath
52+
value: "/var/openebs/local/"
53+
- name: XFSQuota
54+
enabled: "true"
55+
provisioner: openebs.io/local
56+
volumeBindingMode: WaitForFirstConsumer
57+
reclaimPolicy: Delete
58+
```
59+
60+
2. For advanced configuration of XFSQuota, you may also set the `softLimitGrace` and `hardLimitGrace` parameters, which define the storage capacity limits beyond the Persistent Volume (PV) storage request. The updated YAML definition is as follows:
61+
62+
```
63+
apiVersion: storage.k8s.io/v1
64+
kind: StorageClass
65+
metadata:
66+
name: openebs-hostpath-xfs
67+
annotations:
68+
openebs.io/cas-type: local
69+
cas.openebs.io/config: |
70+
- name: StorageType
71+
value: "hostpath"
72+
- name: BasePath
73+
value: "/var/openebs/local/"
74+
- name: XFSQuota
75+
enabled: "true"
76+
data:
77+
softLimitGrace: "0%"
78+
hardLimitGrace: "0%"
79+
provisioner: openebs.io/local
80+
volumeBindingMode: WaitForFirstConsumer
81+
reclaimPolicy: Delete
82+
```
83+
84+
:::note
85+
- `softLimitGrace` and `hardLimitGrace` are used in conjunction with the PV storage request to determine the soft and hard limits of the quota.
86+
87+
- The size of these limits is calculated as **"Size of PV storage request * (1 + LimitGrace%)"**
88+
89+
- If no values are specified, the default is **softLimitGrace: "0%" / hardLimitGrace: "0%"**, meaning the storage capacity is limited to the PV storage request value.
90+
91+
For example, with a PV of 100Gi capacity and values **softLimitGrace: "90%" / hardLimitGrace: "100%"**, the soft limit will be set to 190Gi, and the hard limit will be set to 200Gi.
92+
You can select to use either `softLimitGrace` or `hardLimitGrace` independently based on your requirements.
93+
94+
Refer to the relevant [xfs_quota documentation](https://man7.org/linux/man-pages/man8/xfs_quota.8.html#QUOTA_OVERVIEW) for more detailed instructions regarding the configuration of soft and hard limits.
95+
:::
96+
97+
## Create a PVC
98+
99+
1. To create a PVC using the StorageClass's name, use the following definition:
100+
101+
```
102+
kind: PersistentVolumeClaim
103+
apiVersion: v1
104+
metadata:
105+
name: local-hostpath-xfs
106+
spec:
107+
storageClassName: openebs-hostpath-xfs
108+
accessModes:
109+
- ReadWriteOnce
110+
resources:
111+
requests:
112+
storage: 5Gi
113+
```
114+
115+
At this stage, the PVC will remain in the 'Pending' state until the volume is successfully mounted.
116+
117+
2. Verify the PVC status.
118+
119+
```
120+
$ kubectl get pvc
121+
```
122+
123+
**Example Output**
124+
125+
```
126+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
127+
local-hostpath-xfs Pending openebs-hostpath-xfs 21s
128+
```
129+
130+
## Mount the Volume
131+
132+
1. Mount the volume to the application pod container. A sample BusyBox Pod template is as follows:
133+
134+
```
135+
apiVersion: v1
136+
kind: Pod
137+
metadata:
138+
name: busybox
139+
spec:
140+
volumes:
141+
- name: local-storage
142+
persistentVolumeClaim:
143+
claimName: local-hostpath-xfs
144+
containers:
145+
- name: busybox
146+
image: busybox
147+
command:
148+
- sh
149+
- -c
150+
- 'while true; do echo "`date` [`hostname`] Hello from OpenEBS Local PV." >> /mnt/store/greet.txt; sleep $(($RANDOM % 5 + 300)); done'
151+
volumeMounts:
152+
- mountPath: /mnt/store
153+
name: local-storage
154+
```
155+
156+
The PVC status will change to 'Bound' once the volume is successfully mounted and the quota will be applied.
157+
158+
2. Verify that the XFS project quota is applied.
159+
160+
```
161+
$ sudo xfs_quota -x -c 'report -h' /var/openebs/local/
162+
```
163+
164+
**Example Output**
165+
166+
```
167+
Project quota on /var/openebs/local (/dev/loop16)
168+
Blocks
169+
Project ID Used Soft Hard Warn/Grace
170+
---------- ---------------------------------
171+
#0 0 0 0 00 [------]
172+
#1 0 5.7G 6.7G 00 [------]
173+
```
174+
175+
## Limitation
176+
177+
Resizing of quota is not supported.
178+
179+
## See Also
180+
181+
- [XFS Quota Prerequisites](xfs-quota-pre.md)
182+
- [Modify XFS Quota on LocalPV Hostpath](modify-xfs-quota.md)
183+
- [XFS Quota with Loop Device](xfs-quota-pre.md)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
id: loop-device-xfs-quota
3+
title: XFS Quota with Loop Device
4+
keywords:
5+
- OpenEBS LocalPV Hostpath Modify XFS Quota
6+
- XFS Quota
7+
- XFS Quota with Loop Device
8+
- Advanced Operations
9+
description: This section talks about creating XFS filesystem at the basepath as loop device.
10+
---
11+
12+
# XFS Quota with Loop Device
13+
14+
In scenarios where you do not have an existing device formatted with the XFS filesystem, you can create an XFS filesystem on a loop device. This process is particularly useful when the root filesystem is not XFS and it allows you to simulate an XFS-based storage environment.
15+
16+
This document outlines the steps to create a sparse file, format it with the XFS filesystem, and mount it as a loop device at the specified directory, `/var/openebs/local`, with project quota enabled.
17+
18+
## Create XFS filesystem at the Basepath as Loop Device (If filesystem is not XFS)
19+
20+
If your environment does not have a XFS filesystem, you can use a loop device to create an XFS filesystem. The following steps will guide you through the process of creating a 32MiB sparse file, formatting it with XFS, and mounting it with project quota enabled.
21+
22+
1. **Ensure XFS Utilities Are Installed**
23+
24+
Before proceeding, ensure that the library for managing xfs-fs is installed on your system.
25+
26+
**For Ubuntu/Debian-based Systems**
27+
28+
```
29+
sudo apt update
30+
sudo apt-get install -y xfsprogs
31+
```
32+
33+
**For RHEL/CentOS-based Systems**
34+
35+
```
36+
sudo yum install -y xfsprogs
37+
```
38+
39+
2. **Create the Mount Directory**
40+
41+
Create the directory where the filesystem will be mounted.
42+
43+
```
44+
sudo mkdir -p /var/openebs/local
45+
cd /var/openebs
46+
```
47+
48+
3. **Create a 32MiB Sparse File**
49+
50+
Create a sparse file of maximum size 32MiB.
51+
52+
```
53+
sudo dd if=/dev/zero of=xfs.32M bs=1 count=0 seek=32M
54+
```
55+
56+
4. **Format the Sparse File with XFS**
57+
58+
Format the newly created sparse file with the XFS filesystem.
59+
60+
```
61+
sudo mkfs -t xfs -q xfs.32M
62+
```
63+
64+
5. **Mount the Sparse File**
65+
66+
Finally, mount the sparse file as a loop device with project quota enabled. This will make the file accessible as a directory, `/var/openebs/local`.
67+
68+
```
69+
sudo mount -o loop,rw xfs.32M -o pquota /var/openebs/local
70+
```
71+
72+
## See Also
73+
74+
- [XFS Quota Prerequisites](xfs-quota-pre.md)
75+
- [Enable XFS Quota on LocalPV Hostpath](enable-xfs-quota.md)
76+
- [Modify XFS Quota on LocalPV Hostpath](modify-xfs-quota.md)

0 commit comments

Comments
 (0)