Mounting attaches a filesystem to a directory in the visible namespace. The source can be a block device, network export, virtual filesystem, bind source, or another implementation-specific object. The target directory is called the mount point.
The Filesystem · Lesson 6
mount and umount
Learn how to attach, inspect, and safely detach filesystems using verified sources and mount points.
Preparing and Inspecting a Mount Point
Create a deliberately named directory when local policy calls for it:
$ sudo mkdir -p /mnt/mydrive
Inspect it before mounting:
$ findmnt --target /mnt/mydrive
$ sudo ls -la /mnt/mydrive
Mounting on a nonempty directory hides its existing entries behind the new filesystem until unmounted; it does not delete them. This can confuse applications and consume disk space invisibly, so use an empty, dedicated mount point.
What happens to existing files in a directory when another filesystem is mounted there?
Mounting a Verified Filesystem
After confirming source identity, detected type, and expected contents, mount explicitly:
$ sudo mount -t ext4 /dev/VERIFIED-PARTITION /mnt/mydrive
The -t option specifies the filesystem implementation. Mount can often detect the type, but explicit type and reviewed options make intent clearer. For untrusted or removable content, consider restrictive options such as ro, nosuid, nodev, and noexec where they match the workload; each has limits and must not be treated as a complete sandbox.
Verify what is actually mounted:
$ findmnt --target /mnt/mydrive -o TARGET,SOURCE,FSTYPE,OPTIONS
Mounts are namespace-scoped. A mount created in a container or private service namespace might not appear in another process's view.
What does the mount command do in the shown workflow?
Using Filesystem UUIDs
Enumeration names such as /dev/sdb2 can change. Discover filesystem identifiers with:
$ lsblk -f
$ sudo blkid
Then mount a verified filesystem by UUID:
$ sudo mount UUID=130b882f-7d79-436d-a096-1e594c92bb76 /mnt/mydrive
A UUID identifies the filesystem, not necessarily the physical disk. Reformatting changes it, while cloning can duplicate it. Verify uniqueness before attaching original and clone to the same system.
Why is a filesystem UUID often preferable to /dev/sdX for persistent configuration?
Unmounting Safely
Detach by the exact mount point:
$ sudo umount /mnt/mydrive
The command is spelled umount, without the first n. Successful unmount detaches the filesystem after the kernel completes required writeback and references permit it. Confirm afterward with findmnt before disconnecting storage.
A successful unmount is not always the final safe-removal operation for removable media. Desktop storage stacks may offer an eject or power-off action that flushes device caches and disables a USB device. Follow the platform and hardware workflow.
Which command detaches /mnt/mydrive?
Diagnosing a Busy Filesystem
Unmounting fails when the namespace still has active references, such as open files, a process working directory, nested mounts, swap, or other storage layers. Investigate rather than immediately forcing it:
$ findmnt --submounts /mnt/mydrive
$ sudo fuser -vm /mnt/mydrive
Move shells out of the tree, stop the responsible application cleanly, and unmount child mounts before the parent. Lazy unmount and force options have specialized semantics and can leave active references or risk data loss; use them only with documented recovery reasoning.
Which condition can make umount report that a filesystem is busy?
Use Manage Linux Partitions and Filesystems to practice on designated disposable storage.
Lesson complete
You finished mount and umount
You can now attach and detach filesystems with verifiable scope.
Use an empty, dedicated mount point.
Verify source, type, options, and resulting mount.
Prefer a unique filesystem identifier for persistent references.
Unmount by target and confirm detachment before removal.
Diagnose active references instead of forcing a busy unmount.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account