This is part of the independent and unofficial RHCSA Exam Study Guide series providing free π€ resources to prepare for the exam.
This post covers the objectives under the section:
βCREATE AND CONFIGURE FILE SYSTEMSβ
It contains two main parts:
- Resources: with links to learn and practice for each objective.
- Cheatsheet: containing some examples of commands and actions performed in each objective (when applied).
π Resources:
CREATE, MOUNT, UNMOUNT, AND USE VFAT, EXT4, AND XFS FILE SYSTEMS
MOUNT AND UNMOUNT NETWORK FILE SYSTEMS USING NFS
π RHCSA v8 Practice Session: Mount and unmount network file systems using NFS
π Linux Server Administration - Network File System (NFS) Overview
EXTEND EXISTING LOGICAL VOLUMES
π RHCSA v8 Practice Session: Extend existing logical volumes
π Logical Volume Manager (LVM) versus standard partitioning in Linux
π How to resize a logical volume with 5 simple LVM commands
CREATE AND CONFIGURE SET-GID DIRECTORIES FOR COLLABORATION
π RHCSA v8 Practice Session: Create and configure set-GID directories for collaboration
π Special File Permissions in Linux: SUID, GUID and Sticky Bit
π Create and configure setgid directories for collaboration β RHCSA Objective Preparation
CONFIGURE DISK COMPRESSION
MANAGE LAYERED STORAGE
π How To Manage Layered Local Storage With Stratis On RHEL 8
π 23.1. Setting up Stratis file systems (skip items: from 23.1.6 to 23.1.11)
π 23.2. Extending a Stratis volume with additional block devices
DIAGNOSE AND CORRECT FILE PERMISSION PROBLEMS
(This objective is also covered in: βunderstand and use essential tools / list, set, and change standard ugo/rwx permissionsβ and βmanage security / create and use file access control listsβ)
π Cheatsheet:
CREATE, MOUNT, UNMOUNT, AND USE VFAT, EXT4, AND XFS FILE SYSTEMS
mkfs.ext4 /dev/sdb1β‘ create anext4file system in/dev/sdb1partition.mount /dev/sdb1 /testβ‘ mount/dev/sdb1file system at/testmountpoint (wonβt survive a system reboot).unmount /dev/sdb1β‘ unmount/dev/sdb1filse system.On
/etc/fstabadd/dev/sdb1 /test ext4 defaults 0 0β‘ to mount the file system on system startup.mount -aβ‘ mount all filesystems mentioned in/etc/fstab.
MOUNT AND UNMOUNT NETWORK FILE SYSTEMS USING NFS
(Requires nfs-utils and autofs packages)
Setup NFS server (to serve a directory):
chmod 755 /commonβ‘ add full permissions to dir, before sharing.firewall-cmd --permanent --add-service nfs&firewall-cmd --reloadβ‘ allow NFS traffic to pass throughfirewalld.systemctl --now enable nfs-serverβ‘ enable NFS server.- On
/etc/exportsfile add:/common/ 192.168.0.110(rw) exportfs -avβ‘ export or unexport all items on/etc/exports(verbose mode).
exportfs -u 192.168.0.110:/commonβ‘ unexport dir.Mount share on NFS client (old way to mount):
mkdir /localmount 192.168.0.120:/common /localβ‘ to mount manually.- On
/etc/fstabadd:192.168.0.120:/common /local nfs _netdev 0 0β‘ to mount on system startup. mount | grep localβ‘ to confirm mounting success.
Mount share on client on-demand using AutoFS (preferred way to mount):
(If using AutoFS for a sharing, do not mount manually or via
/etc/fstab!)USING DIRECT MAP
mkdir /autodir- On
/etc/auto.masteradd/- /etc/auto.master.d/auto.dirβ‘ to create the mapping. - Create
/etc/auto.master.d/auto.dirfile and add/autodir 192.168.0.120:/commonβ‘ to automount the shared fs on/autodir.
USING INDIRECT MAP (preferred way)
- On
/etc/auto.masteradd/autoindir /etc/auto.master.d/auto.indirβ‘ to create the indirect mapping. - Create
/etc/auto.master.d/auto.indirfile and addcommon 192.168.0.120:/commonβ‘ to automount the shared fs on/autodir(name the mountpoint just like the shared folderβs name). systemctl enable --now autofsorsystemctl restart autofsβ‘ to start.
- On
EXTEND EXISTING LOGICAL VOLUMES
vgextend vg100 /dev/vdcβ‘ extend volume gropup adding a new physical volume.lvextend -L +200M /dev/vg100/lvol0β‘ expand logical volume size.lvextend -r -L +80M /dev/vg200/lv200β‘ extend local volume and its file system.resize2fs /dev/vg200/lv200 3Tβ‘ resizeext4file system.xfs_growfs /dev/vg200/lv200β‘ resizexfsfile system.
CREATE AND CONFIGURE SET-GID DIRECTORIES FOR COLLABORATION
chmod +2000 /usr/bin/write,chmod g+s /usr/bin/writeβ‘ enablessetgidinwritefile without touching other predefined permissions.chmod +1000 /tmp,chmod o+t /tmpβ‘ sets the sticky bit on the specified directory without altering existing underlying permissions. (sticky bit on public and shared writable dirs are used to protect files and subdirs owned by normal users from being deleted or moved by other normal users.)
CONFIGURE DISK COMPRESSION
(If kernel update was previously installed from file, you might need to download and install vdo and kmod-kvdo from file too.)
vdo list,vdostats,lsblkβ‘ see vdo volumes.vdo create --name=testvdo --device=/dev/vdh --vdoLogicalSize=16G --vdoSlabSize=128Mβ‘ create new vdo volume namedtestvdowith logical size of16GBand slab size of 128mb.vdo status --name testvdo | grep -i duplβ‘ check if vdo volume has deduplication enabled.mkfs.xfs -K /dev/mapper/vdo-nameβ‘ createxfsfilesystem on vdo volume.mkfs.ext4 -E nodiscard /dev/mapper/vdo-nameβ‘ createext4filesystem on vdo volume, avoid discarding blocks.On
/etc/fstabadd/dev/mapper/vdo-name mount-point xfs defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0to mount thexfsfile system.On
/etc/fstabadd/dev/mapper/vdo-name mount-point ext4 defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0to mount theext4file system.vdo disableCompression --name testvdoβ‘ disable compression to vdo volume.
MANAGE LAYERED STORAGE
(Requires stratisd and stratis-cli packages)
systemctl enable --now stratisdβ‘ Start Stratis service.stratis pool create strpool /dev/vdgβ‘ createstrpoolstratis pool using/dev/vdgblock device.stratis pool listβ‘ list pools.stratis blockdevβ‘ display information of block devices used bystratis.stratis fsβ‘ display information ofstratisfilesystems.stratis pool add-data strpool /dev/vdhβ‘ expand the stratis pool adding another block device.stratis fs snapshot my-pool my-fs my-fs-snapshotβ‘ create a snapshot frommy-fsstratisfilesystem.mount /dev/stratis/my-pool/my-fs mount-pointβ‘ mount astratissnapshot.stratis filesystem destroy my-pool my-fs-snapshotβ‘ remove a stratis snapshot (you must unmount the snapshot first).stratis pool destroy strpoolβ‘ remove stratis pool.stratis filesystem create strpool5 strfs5β‘ createstrfs5filesystem onstrpool5stratis pool.On
/etc/fstabaddUUID=a1f0b64a-4ebb-4d4e-9543-b1d79f600283 /fs1 xfs defaults,x-systemd.requires=stratisd.service 0 0β‘ to mount astratisfile system (it must be identified by itβsUUID).
DIAGNOSE AND CORRECT FILE PERMISSION PROBLEMS
chmod 644 somefile.txtβ‘ set file permissions to u=rw,g=r,o=r.chmod +022 somefile.txtβ‘ add g=w,o=w permissions to the file.chmod ug+x,o-wβ‘ add user and group execute permission and remove write permission from others.chown root:sgrp /sdirβ‘ change ownership and owning group torootandsgrprespectively.chmod +4000 /usr/bin/su,chmod u+s /usr/bin/suβ‘ enablessetuidinsufile without touching other predefined permissions. (setuidis used to give special permissions on executable files)chmod +2000 /usr/bin/write,chmod g+s /usr/bin/writeβ‘ enablessetgidinwritefile without touching other predefined permissions.chmod +1000 /tmp,chmod o+t /tmpβ‘ sets the sticky bit on the specified directory without altering existing underlying permissions. (sticky bit on public and shared writable dirs are used to protect files and subdirs owned by normal users from being deleted or moved by other normal users.)chown user1:dba -R dir1β‘ changedir1owner touser1and group todbarecursively (could change only group owning withchgrptoo).setfacl -m u:user100:6 file1,setfacl -m u:user100:rw file1β‘ givesuser100read and write permissions onfile1by using Access Control Lists (ACLs).setfacl -x u:user100 file1β‘ removes anyuser100β‘ ACL permissions forfile1.setfacl -b file1β‘ resets ACL permissions forfile1.setfacl -dm u:user100:7,u:user200:rwx projects/β‘ allocate defaultrwxpermissions touser100anduser200onprojects/dir.setfacl -k projects/β‘ deletes default ACL permissions forprojects/directory.
Next:
(RHCSA) Deploy, Configure, and Maintain Systems
β¦or back to Red Hat Certified System Administrator (RHCSA) Exam Study Guide
Useful links & references:
Enable Sysadmin (a blog from Red Hat)
Footnotes:
- Follow me on Twitter to get more posts like this and other quick tips in your feed.
- If you have any doubts or tips about this article, Iβd appreciate knowing and discussing it via email.
- Do you have any other Linux tips? Would you like to publish that in this blog? Please send an email to all drops.
- As English is not my native language, I apologize for the errors. Corrections are welcome.
- Contact: contact [@] alldrops [.] info.




