Here’s our roadmap: We’ll start by identifying file systems and devices, then dive into mounting and unmounting file systems. After a graded quiz and guided exercise, we’ll cover file-searching with find and locate, followed by a graded lab.
After completing the work in this module you will be able to:
find and locate commands.By the end of this module, you’ll be able to: identify which devices are mounted where; mount and unmount filesystems; and search for files using find and locate.
This section introduces key file systems supported by Red Hat Enterprise Linux: XFS, ext4, exFAT, and GFS2—each serving different use cases. XFS is a high-performance 64-bit journaling file system created by Silicon Graphics, Inc. in 1993. Red Hat Enterprise Linux uses it as the default file system.
Red Hat Enterprise Linux uses the Extents File System (XFS) as the default local file system. Red Hat Enterprise Linux supports the Extended File System (ext4) file system for managing local files. Starting with Red Hat Enterprise Linux 9, the Extensible File Allocation Table (exFAT) file system is supported for removable media use. In an enterprise server cluster, shared disks use the Global File System 2 (GFS2) file system to manage concurrent multi-node access.
To use a file system, it must be mounted to an empty directory—typically under /mnt. That’s how Linux integrates volumes into its directory tree.
A block device is a file that provides low-level access to storage devices. A block device must be partitioned, and a file system created before the device can be mounted. The /dev directory stores block device files, which Red Hat Enterprise Linux creates automatically for all devices. In Red Hat Enterprise Linux 9, the first detected SATA, SAS, SCSI, or USB hard drive is called the /dev/sda device; the second is the /dev/sdb device; and so on.
Block devices are split into partitions—commonly /boot, /home, and /var are on separate partitions. This allows separate management of critical directories.
Logical volumes add flexibility, enabling dynamic resizing while in use. They sit atop physical or partitioned block devices.
Free extents are unused storage segments that can be added to logical volumes as needed—think of them as pre-allocated ‘slices’ of space.
[student@servera ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 892M 0 892M 0% /dev
tmpfs 915M 0 915M 0% /dev/shm
tmpfs 915M 17M 899M 2% /run
tmpfs 915M 0 915M 0% /sys/fs/cgroup
/dev/vda3 8.0G 1.4G 6.7G 17% /
/dev/vda1 1014M 166M 849M 17% /boot
tmpfs 183M 0 183M 0% /run/user/1000
The df -h command lists mounted filesystems with human-readable sizes. Listed are device names, size, usage, and mount points.
Complete this short quiz in Canvas that tests your understanding of devices, partitions, and mount points.
[root@host ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 252:0 0 10G 0 disk
├─sda1 252:1 0 1M 0 part /boot
├─sda2 252:2 0 200M 0 part /boot/efi
├─sda3 252:3 0 9.3G 0 part /
└─sda4 252:4 0 500M 0 part /home
The lsblk command reveals block device hierarchy: disks and their partitions along with sizes and mount points—useful for visualizing device structure.
[root@host ~]# mount /dev/sda4 /home
The mount point directory must exist before mounting the file system. The /mnt directory exists for use as a temporary mount point.
[root@host ~]# lsblk -fp
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
/dev/sda
├─/dev/sda1
├─/dev/sda2 vfat FAT16 7B77-95E7 192.3M 4% /boot/efi
├─/dev/sda3 xfs boot 2d67e6d0-...-1f091bf1 334.9M 32% /boot
└─/dev/sda4 xfs root efd314d0-...-ae98f652 7.7G 18% /
Use lsblk -fp to list device UUIDs. Mounting by UUID improves consistency, especially for removable or re-ordered drives
[root@host ~]# mount UUID="efd314d0-...-3f32ae98f652" /mnt/data
The UUID is truncated to fit the slide.
[root@host ~]# umount /mnt/data
To detach a filesystem, use the umount /mnt/data command. Important: it's not unmount. Ensure no active processes are using the mount point before unmounting.
Let's practice mounting and unmounting filesystems. Verify success with the df command or by checking the mount point's contents.
Now we shift to searching for files. We'll contrast locate (fast and database-driven) vs. find (real-time and flexible).
[root@host ~]# updatedb
The updatedb command refreshes the database that locate uses. Normally run via cron, but you can run it manually.
locate command
[developer@host ~]$ locate passwd
/etc/passwd
/etc/passwd-
/etc/pam.d/passwd
...output omitted...
The locate passwd command quickly lists all files with passwd in their paths fast because it queries a database of file names and not the actual filesystem.
[root@host ~]# find /etc -name '*pass*'
/etc/passwd-
/etc/passwd
/etc/security/opasswd
...output omitted...
The locate command can not find a file that isn't in the database. The find command searches in real time and can find files based on size, modification time, owner, and other criteria.
[root@host ~]# find / -iname '*messages*'
/sys/power/pm_debug_messages
/usr/lib/locale/C.utf8/LC_MESSAGES
/usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES
...output omitted...
Use -iname for case-insensitive searches. In this example find matches the search term regardless of letter case.
[developer@host ~]$ find -user developer
.
./.bash_logout
./.bash_profile
...output omitted...
This example finds files owned by the developer user which is handy for auditing or cleanup.
[user@host ~]$ find -size +1G
ubuntu-25.04-desktop-amd64.iso 5.8G
This example searches for files larger than 1 GB. Useful for tracking down large downloads or backups.
[user@host ~]# find ~/Documents -mmin -20
test.sh
In this example the find command displays files changed in the last 20 minutes.
This example shows how to search by file type using type f for files or type d for directories.
Your turn: use both locate and find to locate specific files on a mounted filesystem. Compare speed and results.
df command reports total disk space, used disk space, and free disk space on all mounted regular file systems./run/media directory when using the graphical environment.lsblk command lists the details of block devices, such as the size and the UUID.find command searches in real time in the local file systems for files according to search criteria.Key takeaways: block devices represent storage; the df command shows mounted filesystems; root mounts and unmounts file systems with the mount and umount commands; lsblk reveals device details; find and locate help locate files.
lsblk command: 2-Minute Linux Tipdu command: 2-Minute Linux Tips/etc/fstab filefind commandExplore these resources for deeper learning: block device explanations, lsblk and du tutorials, and authoritative Red Hat documentation on fstab and find.
In your lab, you’ll mount a local filesystem, locate specific files, and demonstrate both processes. This will reinforce what we’ve learned.
Thank you for your attention! You’ve now covered essential Linux file system management topics. Feel free to reach out if you have questions.
Created on 17 February 2025 by Dennis Kibbe. Last modified on 2 October by DNK.
Keyboard Shortcuts
This slide presentation was created by B6Plus. The audio accompanying this presentation is AI-generated.