Up to $100 off Dedicated Servers

How to Use Disk Quotas in Dedicated Linux Servers with Plesk

Posted on by Chika Ibeneme | Updated:
Reading Time: 7 minutes

Plesk is among the most popular platforms developers and website admins use to manage their server resources. Disk quotas are an essential aspect of managing resources on dedicated Linux servers. They allow admins to limit the amount of disk space each user can use, ensuring the server remains stable and secure.

If you're using Plesk, a popular control panel for Linux and Windows servers, you can easily set up dedicated server disk quotas for your users. This article looks at how to use disk quotas in dedicated Linux servers with Plesk. It covers the basics of disk quotas and their different types and guides you through the steps to set them up disk quotas on your dedicated server.

What Does Disk Quota Do?

As mentioned, disk quota or Linux server disk quotas is a protocol that allows server admins to limit the amount of disk space that a user or group of users can use on a filesystem. The limits can be critical in shared hosting environments or servers with multiple users, where disk space may be limited or expensive. It is sometimes used even with dedicated server hosting.

Users' disk usage is monitored when a dedicated server disk quota is enabled. When they reach their allotted quota, they're prevented from writing additional files to the server. This prevents users from consuming too much disk space, ensuring enough space for other users and applications on the server. In addition, disk quotas can prevent unexpected downtime or data loss caused by filesystems becoming full.

Disk quota is significant on servers where users can upload or create their content, such as web hosting servers, shared file servers, or email servers. Without such limitations, a single user or group of users could easily consume all available disk space, leading to downtime, performance issues, or even data loss in the worst-case scenario.

What Are the Two Types of Disk Quotas?

The two major types of Disk Quotas are usage or block quota and inode or file quota. Let’s explain each of these in detail.

Usage or block quota

Usage quota refers to a dedicated server disk quota system that limits the amount of disk space a user or group can use regarding the number of blocks they can write to the filesystem. For those who may not know, a block is the smallest unit of disk space allocated to a file, and block-level quotas apply to the entire disk block, regardless of the file size. Block-level quotas consider the size of the files written to the filesystem and are typically more accurate in limiting disk space usage.

Inode or file quota

The inode or file quota refers to the disk quota system limiting the number of files a user or group can create or store in a particular directory or on the entire filesystem. File-level quotas are not based on the size of the files but instead on the number of files. This means that even small files contribute to the quota limit, which may not accurately reflect actual disk space usage.

Using Disk Quotas on Plesk Servers

Plesk servers come in a variety of underlying operating systems like: Windows, CentOS, and Ubuntu VPSs, as well as dedicated servers. These systems address disk quotas in different ways. However, they all use the same tools within the Plesk interface. Plesk servers can assign quotas on an individual domain basis or through the Service Plans & Subscriptions system. Below are both of these methods.

Plesk Initial Quota Setup in CentOS 7

As with any server, initialize the quota setup so disk quotas can be tracked. How this is done depends on the underlying operating system. This article includes instructions for initializing our Fully Managed CentOS 7 Plesk servers.

The following outline shows the initial setup of quotas on our Fully Managed Plesk Onyx 17 servers, running the CentOS 7 Linux distribution. These servers do not have quotas enabled by default.

Step 1:

Login to our server via SSH.

Step 2:

Determine the DEVICENAME of the drive that requires quotas. This is done by running the below command.

/usr/local/psa/admin/sbin/usermng --isquotable
Example Output:
~ $ /usr/local/psa/admin/sbin/usermng --isquotable
usermng: Userquota is not enabled on device: /dev/vda3
usermng: Userquota is not enabled on device: /dev/vda3
1

The DEVICENAME for use later is /dev/vda3.

Step 3:

Use the DEVICENAME to identify the UUID for this device. This is done by passing the DEVICENAME along to the following command.

Blkid DEVICENAME
Example Output:
~ $ blkid /dev/vda3
/dev/vda3: UUID="7d7a2cb2-4ef6-42e2-998a-86d6373f5cd1" TYPE="ext4" PARTLABEL="primary" PARTUUID="da626122-0dbe-461e-93af-a7ae3f43f2e4"

Note the UUID of DEVICENAME is 7d7a2cb2-4ef6-42e2-998a-86d6373f5cd1.

Step 4:

At this stage, you have identified the drive by both DEVICENAME and UUID. Next, open the /etc/fstab config file in our preferred editor. Then, identify the lines in the config containing either your UUID or DEVICENAME.

Example by UUID:
~ $ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Apr  4 14:11:03 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=7d7a2cb2-4ef6-42e2-998a-86d6373f5cd1 /         ext4  defaults    1 1
UUID=54cda6e8-74f4-40a9-a79a-e288ed321a3e swap      swap  defaults    0 0
Example by DEVICENAME:
~ $ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Apr  4 14:11:03 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/vda3 /                   	ext4	defaults    	1 1
/dev/vaa2 swap                	swap	defaults    	0 0

Step 5:

Modify the identified line(s) by appending a usrquota flag onto their defaults flag. Make sure each flag is separated by a single comma, like in the example.

Example by UUID:
~ $ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Apr  4 14:11:03 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=7d7a2cb2-4ef6-42e2-998a-86d6373f5cd1 /       ext4	defaults,usrquota   1 1
UUID=54cda6e8-74f4-40a9-a79a-e288ed321a3e swap 	  swap	defaults    	0 0
Example by DEVICENAME:
~ $ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Apr  4 14:11:03 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/vda3 /                   	ext4	defaults,usrquota    	1 1
/dev/vaa2 swap                	swap	defaults    	0 0

Save our changes to the /etc/fstab config file.

Step 6:

Remount the file system to make it aware of the changes.

mount -o remount /
Example Output:
~ $ mount -o remount /
Note:
There is typically no output from running this command.

Step 7:

Install the quota system package. Use the YUM package manager as in the example.

yum install quota -y
Example Output:
~ $ yum install quota -y
Dependencies Resolved

=============================================================
 Package   Arch       Version           Repository     Size
=============================================================
Reinstalling:
 quota     x86_64     1:4.01-14.el7     system-base    179 k

Transaction Summary
=============================================================
Reinstall  1 Package

Total download size: 179 k
Installed size: 887 k
Downloading packages:
quota-4.01-14.el7.x86_64.rpm           	| 179 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:quota-4.01-14.el7.x86_64           1/1
  Verifying  : 1:quota-4.01-14.el7.x86_64           1/1

Installed:
  quota.x86_64 1:4.01-14.el7

Complete!

Step 8:

Next, prepare quota files. This is done by running the following command.

/sbin/quotacheck -cfmvF vfsv0 /
Example Output:
~ $ /sbin/quotacheck -cfmvF vfsv0 /
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/vda3 [/] done
quotacheck: Old group file name could not been determined. Usage will not be subtracted.
quotacheck: Checked 22834 directories and 123065 files
Note:
Some errors are expected here.

Step 9:

Turn on the quota system.

quotaon DEVICENAME
Example Output:
~ $ quotaon /dev/vda3
Note:
There is typically no output from running this command.

Step 10:

The Plesk interface will not see quotas enabled until you refresh Plesk components. This can be done simply by restarting the Plesk service.

/etc/init.d/psa restart
Example Output:
~ $ /etc/init.d/psa restart
Note:
There is typically no output from running this command.

Disk Quotas should now be available throughout the Plesk interface.

Plesk Service Plans & Subscriptions

Plesk provides quota management through Service Plans & Subscriptions. These features allow the creation of predefined Plans to control a site’s limitations, including disk quotas. Plans can be added, removed, edited, or deleted. Start by logging into Plesk and creating a Service Plan.

Creating a Service Plan in Plesk

  1. Click Service Plans.
  2. Stay on the Hosting Plans tab
  3. Click the Add a Plan button
  4. Wait for the follow-up page to load.
  5. Give the Service Plan a name
  6. Stay on the Resources tab
  7. Set Disk space as needed
plesk-service-plan

Assign Sites to Service Plan Subscriptions

  1. Click on Subscriptions.
  2. Enable check for the needed site.
  3. Click the Change Plan button.
  4. Wait for the follow-up page to load.
  5. Select the service plan from the dropdown.
plesk-service-plan-subscriptions

Plesk Planless Quotas

Service Plans & Subscriptions are not mandatory for disk quotas. Assign quotas on select domains, circumventing the need for a Service Plan. This may be preferred on smaller servers hosting only a few sites versus configuring Service Plans for only a few users.

Planless Quotas in Plesk

  1. Click on Domains.
  2. Click the name of the domain to change.
  3. Wait for the Domain page to finish loading.
  4. Click on Web Hosting Access.
  5. Wait for the Web Hosting Access page to finish loading.
  6. Set Hard quota on disk space as needed.
plesk-planless-quotas

What Do You Do When You Have Reached Your Disk Quota?

If you are a user or among users within a group that has reached its disk quota limit, you can no longer write files to the server. To fix this issue, here are some options you can try out.

  • Identify the files and folders (directories) that occupy most of the server space. You will likely notice unnecessary files and directories that occupy your space.
  • Remove all the unnecessary files or directories that are consuming your server space. Use the rm command to delete files and the rmdir command to delete directories.
  • Consider compressing files or directories to save some server space. Use tools like gzip or tar to compress files or directories.

If the above steps don’t create enough space, consider contacting your hosting provider or admin to allocate more storage by increasing your disk quota.

How Do I Reduce Disk Quota?

To reduce the dedicated server disk quotas of a particular user, follow the steps below

  • Log in to your Linux server as the root user.
  • Identify the user whose disk quota you want to reduce by running the quota command followed by their username.
  • You should then determine the type of disk quota used for the user.
  • If it is a block quota, run the edquota command followed by the username. This command opens the text editor allowing you to edit the quota limit.
  • Save the changes made and close the text editor.

Final Thoughts

In summary, dedicated server disk quotas are essential for managing disk usage on dedicated Linux servers with Plesk. By setting limits on the amount of disk space that users or groups can use, disk quotas help prevent the server from running out of disk space and ensure that all users have fair access to resources.  As a server admin, monitoring disk usage and adjusting disk quotas is essential to ensure the server is running as intended.

Plesk is offered for Linux and Windows VPS Hosting, Cloud Dedicated Servers, and Dedicated Servers. In addition to managing disk quotas, Plesk provides additional features and is fully managed with Liquid Web. Contact the sales team to discuss your options.

Series Navigation
<< Previous Article
Avatar for Chika Ibeneme

About the Author: Chika Ibeneme

Chika Ibeneme is a Community Support Agent at The Events Calendar. He received his BA in Computer Science in 2017 from Northern Caribbean University and has over 5 years of technical experience assisting customers and clients. You can find him working on various WordPress and Shopify projects.

Latest Articles

How to renew an SSL certificate (a paid SSL cert)

Read Article

How to use NextCloud — setup and features

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article