Linux Filesystems and Mounts: A Beginner Guide
Before you begin
- Applies to:Linux hosts where you need to identify a filesystem or mount point.
- Where to start:Open a terminal and start with the read-only inspection steps. Use a lab system for the mount exercise.
- What you need:Have the path you want to inspect. For the optional mount exercise, have sudo access and confirm the lab volume's UUID before using it.
Guide tools
Linux presents files through one directory tree that starts at /. A disk or network filesystem becomes available in that tree when it is mounted at a directory called a mount point. The drive-letter model used by Windows does not apply: /home, /var, and a removable disk can all be directories in the same tree while residing on different filesystems.
Linux filesystem view: a mounted filesystem appears at a directory in the single tree rooted at /.
Read a Linux Path from the Root
Directory TreeA leading slash means the path starts at the filesystem root. These directories are common on Linux systems; exact contents can differ by distribution and installed software.
pwdls -lah /❯ Illustrative Output (Results Vary)
/ Top of the directory tree/home Users' home directories/etc System and service configuration/var Variable data such as logs and caches/tmp Temporary files/usr and /opt Installed operating-system and optional software/mnt and /media Common locations for mounted or removable filesystemsCheck Devices and Mounted Filesystems
Read-Only InventoryThese commands inspect storage. lsblk shows block devices and mount points, findmnt shows the mounted tree, and df reports filesystem capacity. A device such as /dev/sdb may contain more than one partition; do not guess which device to mount or format.
lsblk -o NAME,TYPE,SIZE,FSTYPE,LABEL,UUID,MOUNTPOINTSfindmntdf -hT❯ Illustrative Output (Results Vary)
NAME TYPE SIZE FSTYPE LABEL UUID MOUNTPOINTSvda disk 40G├─vda1 part 1G vfat 7A1B-2C3D /boot/efi└─vda2 part 39G ext4 9b6c... /Filesystem Type Size Used Avail Use% Mounted on/dev/vda2 ext4 39G 12G 25G 33% /Check Space for a Directory or File
Capacityfindmnt —target identifies the mount that contains a path. df -hT shows its filesystem capacity; du -sh estimates how much space a directory’s contents use. du may take time on large trees and access to some files may be denied.
findmnt --target "$HOME"df -hT "$HOME"du -sh "$HOME"❯ Illustrative Output (Results Vary)
TARGET SOURCE FSTYPE OPTIONS/home /dev/vda2 ext4 rw,relatimeFilesystem Type Size Used Avail Use% Mounted on/dev/vda2 ext4 39G 12G 25G 33% /3.4G /home/samFind a Device by Its UUID Before Mounting
MountingA mount point is an existing directory where the root of another filesystem becomes visible. First identify the intended filesystem and its UUID with lsblk; compare the size, label, filesystem type, and UUID with your change plan. Never use an example device name blindly.
lsblk -f
# Replace the placeholder with the UUID you confirmed from lsblk.sudo mkdir -p /mnt/datasudo mount UUID=REPLACE-WITH-CONFIRMED-UUID /mnt/datafindmnt --target /mnt/data❯ Illustrative Output (Results Vary)
TARGET SOURCE FSTYPE OPTIONS/mnt/data /dev/disk/by-uuid/confirmed-filesystem-id ext4 rw,relatimeUnmount Only After Checking for Active Use
Change SafetyBefore unmounting, leave the mount point and close programs using files on it. Check it with findmnt; if umount says the filesystem is busy, identify the users instead of forcing it. Entries in /etc/fstab configure filesystems to be mounted later, including at boot, so mistakes can affect startup.
cd /findmnt --target /mnt/datasudo umount /mnt/datafindmnt --target /mnt/data❯ Illustrative Output (Results Vary)
After unmounting, findmnt --target /mnt/data reports the parent filesystem,because /mnt/data is now an ordinary directory again.References
Your feedback keeps these production procedures accurate and battle-tested.