Operations 12 min read

Master Linux mount and umount with 15 practical examples

This guide walks through creating partitions, formatting them, and using the mount and umount commands on Linux, illustrating fifteen real‑world scenarios such as mounting CDs, viewing all mounts, binding directories, remounting, lazy unmounting, and troubleshooting busy filesystems.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux mount and umount with 15 practical examples

After inserting a new hard disk, utilities like fdisk or parted create partitions, mkfs formats them (ext2/3/4), and mount attaches the filesystem to a directory.

1. Mount a CD-ROM

# mount -t iso9660 -o ro /dev/cdrom /mnt

The -o ro option mounts the CD read‑only; ensure the target directory /mnt exists.

2. View all mounted filesystems

# mount

Running mount without arguments lists every active mount, e.g., a USB drive appears as /dev/sdb on /media/myusb type vfat (rw, ...).

3. Mount everything listed in /etc/fstab

# mount -a

The -a flag reads /etc/fstab and mounts each entry that is not already active.

4. Mount a specific entry from /etc/fstab

# mount /mydata

If the directory name is supplied, mount searches /etc/fstab for a matching device and mounts it.

5. List mounts of a particular filesystem type

# mount -l -t ext2
# mount -l -t ext4

The -t option filters by type; the output shows the only ext2 and ext4 partitions on the system.

6. Mount a floppy disk

# mount /dev/fd0 /mnt
# cd /mnt

After mounting, the floppy’s contents are accessible; unmount with umount /mnt before removal.

7. Bind‑mount a directory

# mount -B /mydata /mnt

This creates an additional mount point /mnt that mirrors /mydata. Verification:

# mount | grep /mydata
# mount | grep /mnt

8. Move a mount point

# mount -M /mydata /mnt/

The -M option relocates the existing mount tree to a new location without unmounting.

9. Mount without updating /etc/mtab

# mount -n /dev/sda6 /mydata

The -n flag performs the mount but does not record it in /etc/mtab, so the mount is invisible to mount listings.

10. Mount read‑only or read/write

# mount /dev/sda6 /mydata -r
# mount -t ext4 -o ro -o noload /dev/sda6 /mydata

Use -r (or -o ro) for read‑only; add noload to prevent journal writes on ext3/4. Omit -r for the default read/write mode.

11. Remount an already mounted filesystem

# mount -o remount,rw /mydata

This changes a read‑only mount to read/write without unmounting.

12. Mount an ISO image

# mount -t iso9660 -o loop pdf_collections.iso /mnt

The -o loop option treats the ISO file as a block device.

13. Unmount multiple mount points at once

# umount /mydata /backup

14. Lazy unmount

# umount -l /mydata

The -l (lazy) flag detaches the filesystem immediately and completes the unmount after any pending I/O finishes.

15. Force unmount and troubleshoot busy mounts

# umount -f /mnt

If a device is busy, umount -f forces the unmount. To identify the holding process, use:

# ps ajx | grep /mydata
# fuser -cu /mydata

These commands show the PID and owner, allowing you to stop the process before retrying the unmount.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxFilesystemMountcommand-lineumount
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.