Blog

LightSail VPS: Enable Filesystem Quota

Tags: awsLightSail

Published on: September 10, 2019 by Shafeer P

LightSail VPS: Enable Filesystem Quota

Scenario:

AWS LightSail VPS are provided with XFS filesystem. But, we cannot enable the quota simply by the mount options in /etc/fstab, but this support needs to be enabled at the kernel level on the boot itself.

Enabling Quota

Step 1: Modifying the GRUB configuration

Modern Operating System uses GRUBv2. We need to modify the grub2.cfg. Directly modifying the grub2.cfg is not recommended. So, we have to tweak the kernel parameters and rebuild the grub2.cfg.

Open the configuration file /etc/default/grub and add the option rootflags=uquota into GRUB_CMDLINE_LINUX

/etc/default/grub

GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL=”serial console”
GRUB_SERIAL_COMMAND=”serial –speed=115200″
GRUB_CMDLINE_LINUX=”console=tty0 crashkernel=auto console=ttyS0,115200 rootflags=uquota”
GRUB_DISABLE_RECOVERY=”true”

Step 2: Re-generating the new grub2.cfg

The grub2.cnf can be re-generated using the following command

grub2-mkconfig -o /boot/grub2/grub.cfg

Step 3: Enabling Quota via /etc/fstab

Add the option uquota  to the mount options

UUID=f41e390f-835b-4223-a9bb-9b45984ddf8d   /   xfs defaults,uquota 0   0

Step 4: Rebooting the server to apply the change

The server needs to be rebooted to apply the changes. Make sure its okay to reboot this server now.

Step 5: Check Quota Status

You can verify the quota using the following command:

xfs_quota -x -c state

Sample output

User quota state on / (/dev/xvda1)
  Accounting: ON
  Enforcement: ON
  Inode: #2991229 (15 blocks, 13 extents)
Group quota state on / (/dev/xvda1)
  Accounting: OFF
  Enforcement: OFF
  Inode: #0 (0 blocks, 0 extents)
Project quota state on / (/dev/xvda1)
  Accounting: OFF
  Enforcement: OFF
  Inode: #0 (0 blocks, 0 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]

 

3rd party software installations

Category : Linux

Shafeer P

Shafeer P

Shafeer is currently working as Senior System Engineer at SupportSages. He is capable of tackling time-consuming issues quickly with his advanced scripting abilities. His unchallenged expertise in solving complex issues in a cut-and-dried way makes him a dependable man in the team. The attitude and philosophy he shows on his workplace make his colleagues call him 'Mr. Perfectionist'. Furthermore, he is a travel and photography enthusiast, and loves to spend his leisure times on music and DIY arts.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend