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 anext4
file system in/dev/sdb1
partition.mount /dev/sdb1 /test
ā” mount/dev/sdb1
file system at/test
mountpoint (won’t survive a system reboot).unmount /dev/sdb1
ā” unmount/dev/sdb1
filse system.On
/etc/fstab
add/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/exports
file 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 /local
mount 192.168.0.120:/common /local
ā” to mount manually.- On
/etc/fstab
add: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.master
add/- /etc/auto.master.d/auto.dir
ā” to create the mapping. - Create
/etc/auto.master.d/auto.dir
file and add/autodir 192.168.0.120:/common
ā” to automount the shared fs on/autodir
.
USING INDIRECT MAP (preferred way)
- On
/etc/auto.master
add/autoindir /etc/auto.master.d/auto.indir
ā” to create the indirect mapping. - Create
/etc/auto.master.d/auto.indir
file 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 autofs
orsystemctl 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
ā” resizeext4
file system.xfs_growfs /dev/vg200/lv200
ā” resizexfs
file system.
CREATE AND CONFIGURE SET-GID DIRECTORIES FOR COLLABORATION
chmod +2000 /usr/bin/write
,chmod g+s /usr/bin/write
ā” enablessetgid
inwrite
file 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 namedtestvdo
with logical size of16GB
and 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
ā” createxfs
filesystem on vdo volume.mkfs.ext4 -E nodiscard /dev/mapper/vdo-name
ā” createext4
filesystem on vdo volume, avoid discarding blocks.On
/etc/fstab
add/dev/mapper/vdo-name mount-point xfs defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0
to mount thexfs
file system.On
/etc/fstab
add/dev/mapper/vdo-name mount-point ext4 defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0
to mount theext4
file 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
ā” createstrpool
stratis pool using/dev/vdg
block device.stratis pool list
ā” list pools.stratis blockdev
ā” display information of block devices used bystratis
.stratis fs
ā” display information ofstratis
filesystems.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-fs
stratis
filesystem.mount /dev/stratis/my-pool/my-fs mount-point
ā” mount astratis
snapshot.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
ā” createstrfs5
filesystem onstrpool5
stratis pool.On
/etc/fstab
addUUID=a1f0b64a-4ebb-4d4e-9543-b1d79f600283 /fs1 xfs defaults,x-systemd.requires=stratisd.service 0 0
ā” to mount astratis
file 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 toroot
andsgrp
respectively.chmod +4000 /usr/bin/su
,chmod u+s /usr/bin/su
ā” enablessetuid
insu
file without touching other predefined permissions. (setuid
is used to give special permissions on executable files)chmod +2000 /usr/bin/write
,chmod g+s /usr/bin/write
ā” enablessetgid
inwrite
file 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
ā” changedir1
owner touser1
and group todba
recursively (could change only group owning withchgrp
too).setfacl -m u:user100:6 file1
,setfacl -m u:user100:rw file1
ā” givesuser100
read and write permissions onfile1
by 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 defaultrwx
permissions touser100
anduser200
onprojects/
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.