Operations 13 min read

Master Linux mount and umount with 15 practical examples

This guide walks through creating partitions, mounting devices and filesystems using the Linux mount command, exploring common scenarios such as mounting CD-ROMs, viewing current mounts, binding directories, remounting, mounting ISO images, and safely unmounting with options like lazy, force, and selective unmounting.

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

After creating partitions on a new disk with tools like fdisk or parted and formatting them with mkfs, you use the mount command to attach a filesystem to a directory and start using it.

1. Mount a CD-ROM

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

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

2. View all mounted filesystems

# mount

Running mount without arguments lists every currently mounted filesystem, as shown in the example output where a USB drive ( /dev/sdb) is mounted on /media/myusb.

3. Mount everything listed in /etc/fstab

# mount -a

The -a flag reads /etc/fstab and mounts all entries that are 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. Re‑issuing the command on an already‑mounted point yields an error indicating the device is busy.

5. List mounts of a particular filesystem type

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

This filters the mount list to show only ext2 or ext4 filesystems.

6. Mount a floppy disk

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

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

7. Bind‑mount a directory to a new location

# mount -B /mydata /mnt

The bind mount makes the same filesystem visible at /mnt. Changes made under either path are reflected in the other.

8. Move a mount point to a new directory

# mount -M /mydata /mnt/

The -M option relocates the existing mount tree without unmounting the original point.

9. Mount without updating /etc/mtab

# mount -n /dev/sda6 /mydata

Using -n performs the mount but does not write an entry to /etc/mtab, so the mount is invisible to mount listings that read that file.

10. Mount read‑only or read/write

# mount /dev/sda6 /mydata -r   # read‑only (same as -o ro)
# mount -t ext4 -o ro,noload /dev/sda6 /mydata   # read‑only with no journal replay

Read‑write is the default; use -w or omit -o rw for normal operation.

11. Remount an already mounted filesystem

# mount -o remount,rw /mydata

The remount option changes mount options (e.g., from read‑only to read‑write) without detaching the filesystem.

12. Mount an ISO image

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

The ISO file is treated as a virtual CD‑ROM and its contents become accessible under /mnt.

13. Unmount multiple mount points at once

# umount /mydata /backup

Specify several targets in a single umount command.

14. Lazy unmount

# umount -l /mydata

The -l (lazy) flag detaches the filesystem immediately but delays cleanup until all references are closed.

15. Force unmount

# umount -f /mnt

If a device is busy, -f forces the unmount; if that fails, a lazy unmount or identifying the holding process with ps or fuser can help.

Additional utilities such as df (to show disk usage), lsof, and fuser (to locate processes using a mount point) are mentioned throughout the examples.

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.