- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
Linux User Management: Configuring Group Disk Quotas
User and group disk quotas set limits on how much storage a user can consume. Quotas are important to preventing users from consuming all of the disk space on a system. In this lab, students will install the `quota` package and learn to configure group and user quotas for a filesystem.
Lab Info
Table of Contents
-
Challenge
Create the app Group as Well as appuser1 and appuser2, and Set the app Group as the Primary Group for Both Users
# groupadd app # useradd -g appuser1 # useradd -g app appuser2 -
Challenge
Create a Filesystem on One of the 2 GB Drives Configured on the System
Check to see what disks are available:
# lsblkCreate a partition on the
/dev/xvdbdisk:# fdisk /dev/xvdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xb3c6ea84. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-4194303, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): Using default value 4194303 Partition 1 of type Linux and of size 2 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.Run the partprobe command to ensure the partition table has been updated:
# partprobeCreate an ext4 filesystem on the
/dev/xvdb1partition:# mkfs -t ext4 /dev/xvdb1 -
Challenge
Create the Directory for the Mount Point and Change the Group to app
# mkdir /app -
Challenge
Configure /etc/fstab with the UUID of /dev/xvdb1, Mount the Filesystem, and change the group of the filesystem to app.
Get the UUID for
/dev/xvdb1:# blkid /dev/xvdb1 /dev/xvdb1: UUID="d6a5691b-a045-463f-bf2b-74d0c71895e2" TYPE="ext4"Paste the UUID into the
/etc/fstabfile with the following options:# vim /etc/fstab UUID=d6a5691b-a045-463f-bf2b-74d0c71895e2 /app ext4 defaults,grpquota 1 2Mount newly added filesytems configured in
/etc/fstab:# mount -aChange the group of the
/appfilesystem toapp:# chgrp app /app -
Challenge
Install the quota Package, Create the Quota Files for the /app Filesystem, and Generate the Table of Current Disk Usage for Each Filesystem
Install the
quotapackage:yum install -y quotaCreate the quota files for the
/appfilesystem:quotacheck -cug /appGenerate the table of current disk usage per filesystem:
quotacheck -avug -
Challenge
Assign a Soft Quota of 512 KB and a Hard Quota of 1M (1024KB) to the app Group, Then Turn Quotas on and Check the Group Quota Configuration for /app
Assign a soft quota of 512 KB and a hard quota of 1M (1024KB) to the
appgroup:$ edquota -g app Disk quotas for group app (gid 1004): Filesystem blocks soft hard inodes soft hard /dev/xvdb1 4 512 1024 1 0 0Turn quotas on for the filesystem:
$ quotaon -vug /appVerify the group quota configuration for
/app:$ repquota -g /app *** Report for group quotas on device /dev/xvdb1 Block grace time: 7days; Inode grace time: 7days Block limits File limits Group used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 16 0 0 1 0 0 app -- 4 512 1024 1 0 0
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.