Managing Linux File Systems on Red Hat: A Practical Lab Guide Working with file systems is a core responsibility for any Linux administrator. This guide walks through a practical lab performed on a Red Hat virtual machine, covering the full lifecycle of storage management: identifying disks, creating partitions, formatting file systems, mounting, analyzing usage, and searching for files. --- 1. Identifying Storage Devices After adding new disks to the Red Hat VM, the first step is to identify them: --- Detecting Newly Added Disks (Hot-Add Scenario) In environments where disk hot-add is supported (such as certain VMware configurations), newly attached disks can be detected by the operating system without requiring a reboot. In such cases, the Linux kernel must be instructed to rescan the hardware buses. For SCSI-Based Disks If the disk is attached via a SCSI controller, trigger a rescan of all SCSI hosts: This command instructs the kernel to scan for new devices on all SCSI controllers. After running it, verify detection using: --- For NVMe-Based Disks If the system uses NVMe devices (common in modern VMware setups), a PCI rescan is required instead: Then confirm the new disk: --- Important Notes These commands only work if the hypervisor successfully presents the disk to the virtual machine. If the disk does not appear after rescanning, a reboot may be required. Always verify new devices using lsblk or dmesg. --- This approach ensures that newly added storage devices are recognized immediately without interrupting system operation. These commands display all block devices, including disks, partitions, file systems, and UUIDs. Newly added disks will appear without partitions or mount points. To view mounted file systems and their usage: This helps distinguish between active file systems and newly added, unused disks. --- 2. Creating Partitions Each new disk must be partitioned before use. This is done with fdisk: Inside the interactive menu: Press n to create a new partition Select p for primary Accept default values for partition number and size Press w to write changes Repeat this process for each new disk. Confirm the result: You should now see partitions such as nvme0n2p1. --- 3. Creating File Systems Red Hat uses XFS as the default file system. Format each partition: This prepares the partitions for mounting and data storage. --- 4. Mounting File Systems Create directories to serve as mount points: Retrieve the UUIDs of the partitions: Mount the file systems using UUID (recommended for stability): Verify the mounts: Using UUID ensures mounts remain consistent even if device names change. --- 5. Understanding Mount Behavior Mounting a file system on a directory hides its existing contents. For example: The file filebefore will no longer be visible. After unmounting: The original contents reappear. This demonstrates that mounting does not delete files—it temporarily overlays the directory. --- 6. Unmounting and Troubleshooting To unmount a file system: If you receive a “target is busy” error, identify active processes: Often, the issue is simply that the current shell is inside the mount point. Changing directories resolves it: --- 7. Analyzing Disk Usage Create test data: Analyze usage with: du shows space used by files and directories df shows overall file system usage Together, they provide a complete view of storage consumption. --- 8. Searching for Files Using locate (fast, database-based): Using find (real-time, flexible): locate is fast but depends on a database, while find searches the live file system and supports advanced filtering. --- Conclusion This lab demonstrates essential Red Hat file system operations: Identifying disks with lsblk Partitioning with fdisk Formatting with mkfs.xfs Mounting with UUIDs Troubleshooting unmount issues Analyzing usage with du and df Searching with locate and find