Courseiva
LPIC-2Chapter 5 of 15Objective 202.2

Advanced Filesystem Management and Quotas

If you never set disk quotas, one user could fill the entire hard drive with a single downloaded movie, and every other user on the system would be unable to save their work. The system might crash, the database might corrupt, and you would spend hours cleaning up the mess. That is why 'Advanced Filesystem Management and Quotas' exists: it lets you control how much disk space each person and each group can use, and it enforces those limits automatically, so one mistake does not bring down the entire server.

12 min read
Intermediate
Updated Jul 23, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Advanced Filesystem Management and Quotas

The Car Park Management Analogy

A multi-storey car park in a busy city centre. The car park has six floors, each with a specific purpose: the ground floor for quick drop-offs, the first and second floors for long-stay shoppers, the third floor for staff, the fourth floor for oversized vehicles, and the roof for overflow. Each floor is a separate partition, but they are all part of the same building.

You are the car park manager. You install barriers that count every car that enters and leaves, and you set limits. You assign each regular driver a badge that determines which floors they can access and how many hours they can stay. A delivery driver gets a four-hour badge for the ground floor only. An office worker gets an eight-hour badge for the third floor. A family on holiday gets a week-long pass for the first and second floors. You do not let anyone park in the wrong zone because that would block the space reserved for others.

One day, the roof reaches its 50-car capacity. The barrier stops allowing entry to that zone and shows a red light. Drivers already parked on the roof are not kicked out because they paid for the space, but no new cars are allowed in until a space frees up. You also set a warning light that flashes when the first floor reaches 80% capacity, giving you time to redirect drivers to the second floor before the zone completely fills.

This car park is a filesystem. The floors are directories or partitions. The badges are quotas and permissions. The 50-car capacity is a hard limit that blocks new writes. The 80% warning is a soft limit that sends a notice to the system administrator. You are the system administrator managing disk space and access for hundreds of users without letting anyone run out of room or intrude on another's space.

How It Actually Works

Filesystem management is the art of organising, creating, and maintaining the structure that stores files on a hard drive or SSD. Think of a filesystem as a giant cabinet with millions of drawers. Each drawer is a file, and the cabinet itself has rules about how drawers are labelled, how deep the drawers can be, and who is allowed to open them.

In Linux, every filesystem sits on top of a block device. A block device is a piece of hardware, like a hard disk or a solid-state drive, that reads and writes data in fixed-size chunks called blocks. The filesystem organises these blocks into files and directories. The most common Linux filesystems are ext4, XFS, and Btrfs.

To manage a filesystem, you need to understand several concepts. The first is mounting. Mounting means attaching a filesystem to a specific directory in the directory tree. For example, if you have a separate hard drive formatted with XFS, you can mount it at /data so that files saved in /data physically live on that other drive. The command 'mount' does this, and 'umount' detaches it.

The second concept is partitioning. A partition is a logical division of a hard drive. You can have one drive with three partitions: one for the operating system, one for user data, and one for swap memory. The 'fdisk' or 'parted' tools create partitions. However, partitions have a strict size, and changing them later can be messy. That is why modern Linux also uses Logical Volume Manager (LVM).

LVM is like having a flexible storage pool instead of fixed partitions. You create a Volume Group (the pool), then carve out Logical Volumes (flexible partitions) from that pool. If a logical volume runs out of space, you can add more storage from the pool without repartitioning the drive. This is a huge advantage for busy servers where uptime matters.

The third concept is quotas. A quota is a limit on disk space or on the number of files (inodes) a user or group can consume. Inodes are data structures that store information about a file, like its size, permissions, and location on the disk. Every file has one inode. When you run out of inodes, you cannot create any new files, even if there is free space left.

Quotas come in two types: soft limits and hard limits. A soft limit is a warning threshold. The user can exceed it temporarily, but only for a grace period (usually seven days). A hard limit is a strict boundary. Once the user hits the hard limit, the system refuses to write any more data and sends an error message.

Setting up quotas involves several steps. First, you enable quota support in the filesystem by adding the 'usrquota' or 'grpquota' option in the /etc/fstab file (the file that tells the system which filesystems to mount and how). Then you remount the filesystem or reboot. Next, you run 'quotacheck' to scan the filesystem and create the quota database files: aquota.user and aquota.group. After that, you use 'edquota' to edit limits for individual users or groups. Finally, you turn quotas on with 'quotaon'.

To view quotas, use 'quota' for your own limits or 'repquota' to see a report of all users. You can also set quotas by project, meaning a group of files that belong to a specific project, which is useful for shared directories.

Advanced filesystem management also includes resizing filesystems, checking filesystem integrity with 'fsck', and using tools like 'tune2fs' to adjust parameters without unmounting. Knowing how to manage quotas and filesystems is essential for any LPIC-2 candidate because real-world servers have hundreds of users and limited disk space, and a single runaway process can fill a 2TB drive in minutes.

Flowchart showing the hierarchy from a physical disk partition to an ext4 filesystem, with quota limits that trigger warnings or blocks, and a feedback loop to the administrator via repquota.

Walk-Through

1

Step 1: Prepare the Filesystem for Quotas

Edit /etc/fstab and add the 'usrquota' and/or 'grpquota' option to the mount options of the target filesystem. For example, change 'defaults' to 'defaults,usrquota,grpquota'. Then remount the filesystem with 'mount -o remount /target' so the kernel recognises the new options.

2

Step 2: Create the Quota Database Files

Run 'quotacheck -cug /target'. The -c flag creates the database files (aquota.user and aquota.group). The -u flag scans for user quotas, and -g scans for group quotas. Without this step, no quota is enforced.

3

Step 3: Turn Quotas On

Run 'quotaon /target' to activate quotas on that filesystem. You can also use 'quotaon -a' to enable quotas on all filesystems listed in /etc/fstab that have quota options. Verify with 'quotaon -p /target' to check if quotas are active.

4

Step 4: Set Individual User Limits

Use 'edquota -u username' to open the quota settings in an editor. Inside, you will see blocks (disk space) and inodes (file count), each with soft and hard limits. Enter the values in kilobytes. For example, set soft to 512000 (500 MB) and hard to 614400 (600 MB). Save and exit.

5

Step 5: Set Group and Project Limits (Optional)

For group quotas, use 'edquota -g groupname'. For project quotas (a set of files with a project ID), use 'edquota -P projectid'. Project quotas require adding the 'prjquota' option in /etc/fstab and assigning project IDs to directories with 'chattr +P directory'.

6

Step 6: Verify and Generate Reports

Run 'repquota /target' to see a summary of all users and groups, their current usage, and their limits. Use 'repquota -h /target' for human-readable sizes. To check a single user's quota, run 'quota -u username'. This step confirms that your settings are applied correctly.

What This Looks Like on the Job

Imagine you are the sole IT administrator for a small university. The university has one Linux server that hosts student home directories, shared course materials, and a WordPress site for the public. The server has a single 4TB hard drive with the /home partition mounted on /dev/sda2 using the ext4 filesystem.

One day, a student in the graphic design course uploads a 50GB video project into their home directory. The video fills the remaining free space on /home. The WordPress site, which writes log files and caches pages to /var/www, also lives on the same partition because /var is not a separate filesystem. The WordPress site now cannot write logs, the site goes down, and the university web page shows a blank white error screen. The IT director calls you frantically.

To prevent this scenario permanently, you decide to implement quotas on /home so that no single user can consume all the storage. Your step-by-step plan looks like this:

Edit /etc/fstab and add the 'usrquota' option to the line for /dev/sda2 /home ext4 defaults,usrquota 0 0.

Run 'mount -o remount /home' to apply the change without rebooting.

Run 'quotacheck -cug /home' to create the quota database files for users and groups.

Run 'quotaon /home' to activate quotas.

Use 'edquota -u jdoe' to set the soft limit for user jdoe to 5GB and the hard limit to 6GB. Set the inode soft limit to 10000 and hard limit to 12000.

Now, if jdoe tries to upload a sixth gigabyte, the system blocks the write and returns 'Disk quota exceeded'. The WordPress site continues running because jdoe cannot fill the whole drive.

But there is another subtle problem: the shared course materials directory /home/shared is a group directory for students in the 'art101' group. If every student in the group uploads their projects individually, the group could still fill the drive. To solve this, you set a group quota on the 'art101' group. You use 'edquota -g art101' and set the group hard limit to 100GB, enough for everyone to work without causing a system-wide outage.

Finally, you set up a cron job (a scheduled task) that runs 'repquota /home' every morning and emails the report to you. That way, you can see which users are approaching their soft limits and proactively ask them to clean up old files.

In this real-world scenario, quotas are not just a technical feature. They are a critical part of system reliability and user management. Without them, a single user or a single group can cause a denial of service for everyone else. With quotas, you guarantee fairness and prevent downtime.

How LPIC-2 Actually Tests This

The LPIC-2 exam topic 202.2, 'Advanced Filesystem Management', tests your ability to configure, maintain, and troubleshoot complex filesystem setups, including quotas. The exam expects you to know specific commands, their flags, and the exact syntax of configuration files. It also tests your understanding of the underlying concepts, not just rote memorisation.

Here is what the exam specifically tests regarding quotas:

The difference between soft limits and hard limits, and what happens when a user exceeds each. The trap is that many candidates forget that the soft limit has a grace period, and the hard limit is immediate.

The exact command to turn quotas on ('quotaon') and off ('quotaoff'), and their flags (e.g., -a for all filesystems, -u for users, -g for groups).

How to enable quotas in /etc/fstab. They will show you a /etc/fstab line and ask which option is missing. The correct answer is 'usrquota' or 'grpquota' depending on the context.

The 'quotacheck' command and its flags. They love testing that 'quotacheck -cug' creates the aquota.user and aquota.group files. Do not forget the -c flag.

The 'edquota' command and how to edit limits. They may ask what 'edquota -p templateuser targetuser' does: it copies the quota settings from the template user to the target user. This is a common timesaving trick they expect you to know.

The 'repquota' command for generating reports. They might ask which flag shows human-readable sizes (-h).

Beyond quotas, the exam tests:

Resizing ext4 filesystems with 'resize2fs'. The trap: you must resize the underlying device (partition or logical volume) first, then run 'resize2fs'. Doing it the other way round causes errors.

Resizing XFS filesystems with 'xfs_growfs'. XFS can only be grown, not shrunk. Many beginners try to shrink an XFS filesystem and fail.

LVM management: creating volume groups ('vgcreate'), logical volumes ('lvcreate'), extending logical volumes ('lvextend'), and resizing the filesystem after extending. The exam often asks a multi-step question: 'You have a logical volume at 80%, you add a new disk to the volume group, then extend the logical volume. What command do you run next to make the extra space available without unmounting?' Answer: 'resize2fs' or 'xfs_growfs'.

Filesystem integrity checks: 'fsck' and its variants (e2fsck for ext2/3/4, xfs_repair for XFS). The trap: running fsck on an already-mounted filesystem can cause severe data corruption. The exam expects you to know that you must unmount the filesystem first unless you are doing a read-only check with the -n flag.

The 'tune2fs' command to adjust filesystem parameters, such as the mount count before a forced fsck (-c flag) or the reserved block percentage (-m flag).

To revise, create a cheat sheet of every command mentioned here, with the most important flags. Practise the steps in order: create a filesystem, mount it, enable quotas, set limits, verify with repquota. If you can do that from memory without notes, you are ready.

Key Takeaways

Quotas enforce hard and soft limits on both disk space (blocks) and file count (inodes) for users, groups, and projects.

The soft limit allows a temporary grace period before it becomes a hard limit, which the administrator configures with 'edquota -t'.

To enable quotas, you must add 'usrquota' or 'grpquota' to the filesystem's options in /etc/fstab, then run 'quotacheck' and 'quotaon' in that exact order.

Resizing an ext4 filesystem requires resizing the underlying block device first (partition or LVM logical volume), then running 'resize2fs'.

XFS filesystems can only be grown with 'xfs_growfs', never shrunk, while ext4 can be both grown and shrunk (though shrinking ext4 is risky and requires unmounting).

The 'fsck' command must never be run on a mounted writable filesystem; always unmount first or use 'fsck -n' for a read-only check.

LVM separates physical storage (Physical Volumes) from logical storage (Logical Volumes) via a Volume Group, allowing flexible resizing without repartitioning the disk.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Soft Limit

Allows temporary exceedance for a configurable grace period.

Only logs a warning; does not block writes immediately.

Default grace period is usually seven days after first exceedance.

Hard Limit

Blocks all writes immediately and returns an error message.

No grace period applies; the limit is absolute.

The user must delete files or request an increase to write again.

ext4

Supports both growing and shrinking (shrinking requires unmount).

Maximum filesystem size is 1 exabyte (but is 50 TiB in some kernels).

Can be resized online (grow) with resize2fs without unmounting.

XFS

Supports only growing, never shrinking.

Maximum filesystem size is 8 exabytes (much larger than ext4).

Resized online with xfs_growfs; requires a mount point, not a device.

Partition

Fixed size defined at creation; resizing requires repartitioning.

Cannot span across multiple physical disks.

Directly bound to a physical disk sector range.

Logical Volume (LVM)

Flexible size; can be grown or shrunk without repartitioning.

Can span multiple physical disks by combining them into a volume group.

Abstracted from the physical disk; requires LVM tools to manage.

User Quota

Limits disk usage for an individual user account.

Configured with edquota -u username.

Useful for preventing a single user from filling the filesystem.

Group Quota

Limits total disk usage for all members of a group combined.

Configured with edquota -g groupname.

Useful for shared directories where multiple users need a collective limit.

fsck

Used for ext2/ext3/ext4 filesystems only.

Can be run in interactive or automatic mode ( -p or -y ).

Must never be run on a mounted writable filesystem.

xfs_repair

Used exclusively for XFS filesystems.

Requires the filesystem to be unmounted; no interactive mode.

Has a -n flag for dry-run (log only) mode to check without modifying.

Watch Out for These

Mistake

Quotas are only about disk space, not about the number of files.

Correct

Quotas limit both disk space (measured in kilobytes or blocks) and the number of inodes (files). A user can run out of inodes before they run out of space, preventing them from creating any new files.

Beginners often think 'disk quota' only means space. The concept of inodes is not intuitive because it is not visible in everyday file operations.

Mistake

Once a user hits the hard limit, the system deletes their oldest files automatically to free up space.

Correct

The hard limit blocks any new writes, but it does not delete existing files. The user must manually delete files or ask an administrator to increase the limit.

Users familiar with cloud storage services that auto-delete after a quota may assume the same behaviour on Linux, which is safer and more conservative.

Mistake

You can set quotas on any filesystem type, including FAT32 and NTFS, without any special steps.

Correct

Quotas are only supported on filesystems that have the necessary metadata structure, such as ext4, XFS, and Btrfs. FAT32 and NTFS do not support Linux quotas at all.

People assume the Linux kernel can enforce quotas on everything. In reality, the filesystem driver must implement quota tracking, which these simpler filesystems do not.

Mistake

Resizing a filesystem and resizing a partition are the same thing.

Correct

Resizing a partition changes the logical boundary on the disk, while resizing a filesystem updates the internal metadata to use the new space. You must resize the partition (or logical volume) first, then resize the filesystem, or the filesystem will not see the extra space.

The terms are often used interchangeably in casual conversation, so beginners do not realise there are two distinct steps with two different commands.

Mistake

The 'fsck' command is safe to run on any mounted filesystem as long as you are careful.

Correct

Running 'fsck' on a mounted filesystem (especially with write access) can seriously corrupt the filesystem. The only safe mode on a mounted filesystem is a read-only check using 'fsck -n'.

Users might see 'fsck' as a benign check, like 'chkdsk' in Windows which often runs on mounted drives. Linux is less forgiving, and the exam firmly tests this distinction.

Mistake

LVM snapshots are a replacement for backups and do not consume any extra disk space.

Correct

LVM snapshots are not backups. They are point-in-time copies that consume space as writes to the original volume change. If the snapshot fills up, it becomes invalid. They are useful for quick rollbacks but should not be used as a backup strategy.

The word 'snapshot' sounds harmless and temporary, so beginners think they are cost-free. In reality, a snapshot can fill up and cause data loss if not monitored.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What is the difference between a soft limit and a hard limit in disk quotas?

A soft limit is a warning threshold that the user can exceed for a limited time (the grace period). A hard limit is a strict boundary that, once reached, blocks any further writes and returns a 'Disk quota exceeded' error.

How do I set the grace period for soft limits?

Use 'edquota -t' to set the grace period for all users on the filesystem. The default is usually seven days. You can set it in seconds, minutes, hours, days, or weeks.

Can I copy quota settings from one user to another?

Yes, use 'edquota -p templateuser targetuser'. This copies all quota settings (soft and hard limits for blocks and inodes) from the template user to the target user, saving time when setting up many users with identical limits.

Why does 'repquota' show that my quota limits are set but the user can still write more than the hard limit?

Most likely, the quotas are not turned on. Run 'quotaon -v /filesystem' to enable them. Alternatively, the filesystem may not have been remounted with the 'usrquota' or 'grpquota' option. Check /etc/fstab and remount.

What happens if I run 'fsck' on a mounted filesystem by accident?

Running 'fsck' on a mounted writable filesystem can cause severe data corruption and make the filesystem unmountable. The kernel may panic or crash. Always unmount first or use 'fsck -n' for a read-only check.

How do I shrink an ext4 filesystem?

First, unmount the filesystem. Then run 'e2fsck -f /dev/sdXN' to check for errors, then use 'resize2fs /dev/sdXN wantedSize' (e.g., 10G). After that, shrink the partition with a tool like fdisk. Shrinking is risky, so always have a backup before attempting.

What is the difference between a partition and a logical volume in LVM?

A partition is a fixed, contiguous section of a hard drive that cannot change size easily. A logical volume is a flexible chunk of storage carved from a volume group (a pool of physical volumes) and can be grown or shrunk without touching the underlying disk structure.

Terms Worth Knowing

Keep going

You've finished Advanced Filesystem Management and Quotas. Continue through the LPIC-2 study guide to build a complete picture of the exam.

Done with this chapter?