Domain 6File SystemsCORE

Create and configure file systems

Creating XFS and Ext4 file systems, persistent mounting via /etc/fstab with UUIDs, NFS client configuration, and on-demand automounting with AutoFS.

Domain: Domain 6: Create and configure file systems•Updated: 2026-08-29
#XFS#Ext4#NFS#AutoFS#fstab#Mounts#File Systems

RHCSA Commands: File Systems


1. File System Creation (mkfs family)

Command Description Example
mkfs Generic command to create a file system on a block device sudo mkfs -t ext4 /dev/sdb1
mkfs.ext4 Create an Ext4 file system (alias for mke2fs -t ext4) sudo mkfs.ext4 /dev/vgfs/ext4vol
mkfs.xfs Create an XFS file system; -f forces overwrite of existing signatures sudo mkfs.xfs -f /dev/sdc
mkfs.vfat Create a VFAT file system (equivalent to mkfs -t vfat) sudo mkfs.vfat /dev/sdb2
mke2fs Create an Extended file system (Ext2/3/4); same as mkfs.ext4 sudo mke2fs -t ext4 /dev/sdb1

2. Extended File System (Ext2/3/4) Management

Command Description Example
e2label Set or view the label of an Ext2/3/4 file system sudo e2label /dev/sda1 mylabel
tune2fs View or modify Ext2/3/4 tunable file system attributes; -l lists superblock info (including UUID) sudo tune2fs -l /dev/sda1
resize2fs Resize an Ext2/3/4 file system (usually called automatically by lvextend -r) sudo resize2fs /dev/vgfs/ext4vol
e2fsck File system check and repair utility for Extended file system types (referenced in fstab column 6) sudo e2fsck -f /dev/sdb1

3. XFS File System Management

Command Description Example
xfs_admin Tune XFS file system attributes; -l shows label, -L sets label (FS must be unmounted), -u shows UUID sudo xfs_admin -L bootfs /dev/sda1
xfs_growfs Grow an XFS file system (must be mounted; takes mount point, not device) sudo xfs_growfs /xfsfs2
xfs_info Display information about a mounted XFS file system sudo xfs_info /xfsfs1
xfs_repair Manually repair an XFS file system (must be unmounted) sudo xfs_repair /dev/sdc

4. Block Device & File System Inspection

Command Description Example
blkid Display block device attributes including UUID, LABEL, and TYPE sudo blkid /dev/sda1
lsblk List block devices and their attributes; -f shows file system info (UUID, label, type) sudo lsblk -f
lsblk List block devices with specific device details sudo lsblk -f /dev/sda1

5. Mounting and Unmounting

Command Description Example
mount Mount a file system; with no args, displays currently mounted file systems sudo mount /dev/sdb1 /ext4fs1
mount -a Mount all file systems listed in /etc/fstab that are not currently mounted sudo mount -a
mount -t <type> Show/mount only a specific file system type mount -t xfs
mount -t nfs server:/share /mnt Mount an NFS share manually sudo mount -t nfs server2:/common /local
mount server:/ /mnt NFSv4 pseudo root mount (mount all NFS shares at once) sudo mount server2.example.com:/ /mnt
`mount grep ` Filter mount output to find specific mounts
mount -o remount,<options> Remount an already mounted file system to enable/disable an option sudo mount -o remount,ro /boot
umount Unmount a file system by mount point or device sudo umount /mnt

mount Command Options (used in /etc/fstab and CLI)

Option Description
defaults Mount with all default values (async, auto, rw, suid, dev, exec, nosuid)
ro Mount read-only
rw Mount read/write
acl / noacl Enable/disable ACL support
auto / noauto Mount at boot / do not mount at boot
_netdev Wait for network connectivity before mounting (required for NFS, VDO, Stratis)
remount Remount an already mounted file system
sync Commit modified files to the remote file system immediately (NFS)
nfsvers=<version> Force a specific NFS version for the mount
x-systemd.requires=vdo.service Wait for VDO service before mounting (VDO file systems)
x-systemd.requires=stratisd.service Wait for Stratis service before mounting (Stratis file systems)
pri=X Set swap priority (higher number = higher priority; range -2 to 32767)

6. Disk Usage Monitoring

Command Description Example
df Report file system disk space usage for mounted file systems df -h
df -h Show disk usage in human-readable format df -h
df -hT Show disk usage with file system type df -hT
df -t <type> Limit output to a specific file system type df -t xfs
df -hx <type> Exclude a specific file system type from output df -hx tmpfs
df -hi Show inode information in human-readable format df -hi
du Estimate file/directory space usage du /usr/bin
du -sh <path> Show usage summary of a directory in human-readable format du -sh /var
du -c <path> Add a grand total row to the output du -c /usr/bin

7. Swap Management

Command Description Example
mkswap Set up (initialize) a Linux swap area on a device or partition sudo mkswap /dev/sdb3
swapon Enable/activate a swap device; with no args, shows current swap usage sudo swapon /dev/sdb3
swapon -a Enable all swap areas listed in /etc/fstab sudo swapon -a
swapon -s Show swap usage in table format swapon -s
swapoff Disable/deactivate a specific swap device sudo swapoff /dev/sdb3
free Display total, used, and free memory and swap space free -h
free -h Show memory and swap in human-readable format free -h
free -ht Show memory and swap with a total line at the bottom free -ht
free -hts <sec> Refresh output every N seconds free -hts 3
free -htc <count> Display the output N times free -htc 2

Command Description Example
pvcreate Initialize a physical volume for use in LVM sudo pvcreate /dev/sdd1
vgcreate Create a volume group; -s sets PE size sudo vgcreate -s 16M vgfs /dev/sdd1
vgextend Add a physical volume to an existing volume group sudo vgextend vgfs /dev/sde
lvcreate Create a logical volume; -L sets size, -n sets name sudo lvcreate -L 80M -n ext4vol vgfs
lvextend Extend a logical volume; -r automatically resizes the underlying file system sudo lvextend -r -L +40M /dev/vgfs/ext4vol
lvresize Resize a logical volume to a specific size; -r resizes the file system simultaneously sudo lvresize -r -L +40M /dev/vgfs/xfsvol
pvs Display physical volume summary pvs
vgs Display volume group summary vgs
lvs Display logical volume summary lvs
vgdisplay Display detailed volume group information vgdisplay
lvdisplay Display detailed logical volume information lvdisplay
fsadm File system administration; resize subcommand grows the file system to full LV size sudo fsadm resize /dev/vgfs/ext4vol

9. VDO Commands

Command Description Example
vdo Create and manage VDO volumes sudo vdo create --name=vdo1 --device=/dev/sdf --vdoLogicalSize=16G
vdo list List VDO volumes vdo list
vdostats Display VDO volume statistics vdostats

10. Stratis Commands

Command Description Example
stratis pool create Create a Stratis pool sudo stratis pool create strpool /dev/sdg
stratis pool list List Stratis pools stratis pool list
stratis pool add-data Add a disk to an existing pool sudo stratis pool add-data strpool /dev/sdh
stratis filesystem create Create a file system in a Stratis pool sudo stratis filesystem create strpool strfs2
stratis filesystem list List file systems in a pool stratis filesystem list strpool
stratis blockdev list Show block devices used in a pool stratis blockdev list strpool
stratis pool stats Check pool usage statistics stratis pool stats strpool
stratis filesystem stats Check file system usage statistics stratis filesystem stats strpool strfs2

11. Partitioning

Command Description Example
parted Partition management utility sudo parted /dev/sdb
parted /dev/sdX mklabel msdos Apply an MS-DOS partition table to a disk sudo parted /dev/sdb mklabel msdos
parted /dev/sdX mkpart Create a new partition sudo parted /dev/sdb mkpart primary ext4 1 100
parted /dev/sdX print Display partition table of a disk sudo parted /dev/sdb print

12. NFS Server Commands

Command Description Example
dnf install nfs-utils Install NFS server and client utilities sudo dnf install -y nfs-utils
systemctl enable --now nfs-server Start and enable the NFS server service sudo systemctl enable --now nfs-server
systemctl status nfs-server Verify the operational status of the NFS server sudo systemctl status nfs-server
exportfs Maintain the NFS export table sudo exportfs
exportfs -av Export all entries in /etc/exports with verbose output sudo exportfs -av
exportfs -u <share> Unexport a specific share sudo exportfs -u /common
exportfs -au Unexport all shares sudo exportfs -au
showmount -e <server> Show NFS export list on a remote server showmount -e server2.example.com
mkdir -p <path> Create directories to be shared via NFS sudo mkdir -p /nfsdata /users/user1 /users/user2
chmod 777 <path> Add full permissions to a shared directory sudo chmod 777 /common

Key NFS Server Configuration Files

File Purpose
/etc/exports Define NFS shares and their access options (e.g., /nfsdata *(rw,no_root_squash))
/etc/nfs.conf NFS server configuration file

13. NFS Client Commands

Command Description Example
dnf install nfs-utils Install NFS client utilities (includes showmount) sudo dnf install -y nfs-utils
mount -t nfs server:/share /mnt Mount an NFS share manually sudo mount -t nfs server2:/common /local
mount server:/ /mnt NFSv4 pseudo root mount sudo mount server2.example.com:/ /mnt
umount /mnt Unmount an NFS share sudo umount /local
showmount -e <server> List shares offered by an NFS server showmount -e server2.example.com

NFS fstab Entry Format

server:/share  /mnt  nfs  defaults,_netdev  0  0

Or with sync option to prevent data loss:

server:/share  /mnt  nfs  sync  0  0

14. AutoFS (Automount) Commands

Command Description Example
dnf install autofs Install the AutoFS package sudo dnf install -y autofs
systemctl enable --now autofs Start and enable the AutoFS service sudo systemctl enable --now autofs
systemctl restart autofs Restart the AutoFS service (after config changes) sudo systemctl restart autofs
systemctl status autofs Verify the operational status of the AutoFS service sudo systemctl status autofs -l --no-pager
ls <mount-point> Trigger an automount by accessing the mount point ls /nfsdata/files
cd <mount-point> Trigger an automount by changing to the mount point cd /nfsdata/files
mount Verify automount has occurred (check autofs entries) mount
`mount grep ` Filter mount output for specific automount entries

Key AutoFS Configuration Files

File Purpose
/etc/autofs.conf Main AutoFS configuration (timeout, logging, NFS protocol version)
/etc/auto.master Master map — defines mount points and their corresponding map files
/etc/auto.misc Default indirect map file for removable media
/etc/auto.master.d/ Directory for user-defined map files (auto-loaded at startup)

AutoFS Map Syntax

Master Map (/etc/auto.master):

/mount-point    /path/to/map-file

Indirect Map (e.g., /etc/auto.nfsdata):

subdirectory    -rw    server:/share

Direct Map (e.g., /etc/auto.master.d/auto.dir):

/mount-point    -rw    server:/share

Wildcard Map (for home directories):

*    -rw    server:/users/&
  • * = matches any local mount point name
  • & = substitutes the matched name on the remote side

Command Description Example
firewall-cmd --add-service=nfs --permanent Allow NFS traffic through the firewall sudo firewall-cmd --add-service=nfs --permanent
firewall-cmd --add-service=rpc-bind --permanent Allow rpc-bind (portmapper) traffic sudo firewall-cmd --add-service=rpc-bind --permanent
firewall-cmd --add-service=mountd --permanent Allow mountd traffic sudo firewall-cmd --add-service=mountd --permanent
firewall-cmd --reload Apply firewall rule changes sudo firewall-cmd --reload

16. Package Management

Command Description Example
dnf install Install RPM packages sudo dnf install -y nfs-utils
dnf install autofs Install AutoFS package sudo dnf install -y autofs
dnf install nfs-utils autofs Install both NFS and AutoFS packages sudo dnf install -y nfs-utils autofs

17. Systemd Service Management

Command Description Example
systemctl enable --now <service> Start a service now and enable it at boot sudo systemctl enable --now nfs-server
systemctl status <service> Check service status sudo systemctl status autofs
systemctl restart <service> Restart a running service sudo systemctl restart autofs

18. User Management (for NFS Home Directory Setup)

Command Description Example
useradd Create a new user account sudo useradd -u 3000 user30
useradd -u <uid> -b <base> -M Create user with specific UID, base dir, no home directory sudo useradd -u 3000 -b /nfshome -M user30
passwd <user> Set/change a user’s password sudo passwd user30

19. General File/Directory Operations (Referenced in Exercises)

Command Description Example
mkdir Create a directory (mount point) sudo mkdir /ext4fs1
mkdir -p Create directory and parent directories as needed sudo mkdir -p /nfsdata /users/user1
cp Copy files cp /etc/[a-c]* /nfsdata
ls List directory contents ls /mnt
pwd Print working directory pwd
cd Change directory cd /nfsdata/files
grep Search text in files/output grep boot /etc/fstab
vim Text editor for configuration files vim /etc/fstab

20. Key Configuration Files Reference

File Purpose
/etc/fstab Persistent file system and swap mount definitions (6 columns: Device, Mount Point, Type, Options, Dump, Fsck)
/etc/exports NFS server share definitions
/etc/autofs.conf AutoFS global configuration (timeout, logging, NFS protocol)
/etc/auto.master AutoFS master map
/etc/auto.misc AutoFS default indirect map
/etc/auto.master.d/ AutoFS user-defined map files directory
/etc/nfs.conf NFS server configuration
/proc/meminfo Virtual file with runtime memory and swap information
/proc/swaps Virtual file with current swap area information
/proc/self/mounts Virtual file with currently mounted file system information
/etc/mtab Mount table listing all mounted file systems (local and remote)