CloudAcademy
  1. Home
  2. Training Library
  3. Cloud Computing Fundamentals
  4. Courses
  5. LPIC-1 101 Linux certification - Linux Partitions and Filesystems (5 of 5)

Manage disk quotas

The course is part of this learning path

play-arrow
Start course
Overview
DifficultyIntermediate
Duration46m
Students685

Description

This course - Linux partitions and filesystems - concludes the first half of our Linux certification series and, not coincidentally, covers the last topics you'll need to know for the LPIC-1 101 exam. The final six courses will get you up to speed on the 102 exam.

Besides getting to know the Linux Filesystem Hierarchy Standard, we'll learn how to:

  • Create and maintain secure and reliable partitions and filesystems
  • Mount and unmount filesystems
  • Limit access to only authorized users.
  • Create and manage hard and symbolic linked files.
  • Control the disk space allocation.

The previous course covered the Linux command line. 

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.

Transcript

Controlling Linux disk space usage using quotas

If you're managing a system with multiple users, but finite disk resources, you might want to set limits for how much disk space will be allowed to individual users, or even groups. This can be helpful if some of your team members are in the habit of downloading hundreds of cute kitten videos from YouTube, or if you're worried that certain processes might automatically generate huge log files. You can manage limits using the Quota tool.

First of all, you'll need to make sure that Quota is actually installed on your system, on my Fedora Distribution, it is.

Next, we would edit the /etc/fstab file to add quota options to each filesystem. In our case, we've already added user quota and group quota to enable quotas for both users and groups to the filesystem mounted to /home. The easiest and surest way to have these changes take effect is to reboot the system. Since we didn't actually change anything this time, we can obviously skip that step. To build a table of the current disk usage on our filesystem, update the disk quota files, and if necessary, create the aquota.group and aquota.user files, we would run quotacheck -avmug. A = all, M will force a check on mounted file systems, U and G will check users and groups, and V = verbose.

Quota isn't actually switched on out of the box. We'll run quotaon -av, where A stands for all, and V for verbose, to start it up. Let's use repquota which stands for report quota to take a look at what's going on. We can see that there are currently only two users being monitored by quota, root and my user. In fact, there are currently no other user accounts in the system. We can also see there are two different kinds of limits, blocks and files. Quota allows you to apply limits using either metric.

A hard limit acts like a solid wall, if a user would try to create a file that pushes him over his limit, the operation will simply fail. A soft limit will allow the operation to succeed, but will only allow the excess data to survive for a specified time, which by default is seven days. The value 0 means that there are currently no limits on this account. We can edit the limits allowed to a user or group using edquota -u to edit a user's quota, or edquota -g to edit a group's quota. Let's run this on my own account, not that I would ever seriously consider cutting back on my consumption of cute kitten videos, mind you.

We'll run edquota -u as sudo. We've actually been dropped into the text editor Vi, and I'm sure that now you're really happy you paid attention during the Vi video in the previous course. We can hit the I key to enter insert mode, so we can edit a value. I could create a real limit, either through the block or inode, meaning file. For now, I'll just hit escape and then colon and Q to exit. You can edit the soft limit grace period using edquota -t, again you can control the grace period for both block and inode limits.

Let's review. Quota allows you to impose limits on the amount of disk space users or groups can consume. Once you've applied Quota configuration to each of the relevant filesystems using fstab, quotacheck will build the environment you need to get started. Quotaon will enable quota controls, quotaoff will disable controls, repquota will print a report of the current quota status of each user and group, edquota -u will let you edit a user's profile, edquota -g will do the same for a group, and edquota -t lets you edit the length of your soft limit grace period.

About the Author

Students15425
Courses17
Learning paths2

David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.

Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.

Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.

His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.

Covered Topics