Master Linux mount & umount: 15 Real‑World Examples and Tips
This guide walks through the Linux mount and umount commands, covering everything from mounting CD‑ROMs and floppy disks to binding mount points, using /etc/fstab, listing specific filesystem types, and handling forced or lazy unmounts with clear, step‑by‑step examples.
After inserting a new hard disk, administrators typically create partitions with fdisk or parted, format them with mkfs, and then mount the resulting filesystem. This article explains the mount and umount utilities through fifteen practical examples.
1. Mount a CD-ROM
CD devices appear under /dev. The following command mounts a read‑only CD‑ROM: # mount -t iso9660 -o ro /dev/cdrom /mnt Ensure the target directory ( /mnt) exists before mounting.
2. List all mounted filesystems
Running mount without arguments displays every active mount. After plugging a USB drive, the output shows the device, mount point, filesystem type and options. # mount You can also use df to see space usage for each mount point.
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 195069136 128345036 56958520 70% /
...3. Mount all filesystems listed in /etc/fstab
The /etc/fstab file defines filesystems to be mounted at boot. To (re)mount every entry, use the -a option: # mount -a Typical /etc/fstab entries:
# cat /etc/fstab
proc /proc proc nodev,noexec,nosuid 0 0
/dev/sda5 / ext4 errors=remount-ro 0 1
/dev/sda6 /mydata ext2 defaults 0 2
/dev/sda7 /backup vfat defaults 0 3Unmounting all entries can be done with umount -a.
4. Mount a specific filesystem from /etc/fstab
If you provide only a directory name, mount searches /etc/fstab for a matching entry and mounts it: # mount /mydata Attempting to mount the same entry again yields an “already mounted” error.
5. List mounts of a particular type
Use -t together with -l to filter by filesystem type:
# mount -l -t ext2
/dev/sda6 on /mydata type ext2 (rw)
# mount -l -t ext4
/dev/sda5 on / type ext4 (rw,errors=remount-ro)6. Mount a floppy disk
Floppy devices are also under /dev. Example:
# mount /dev/fd0 /mnt
# cd /mntAfter use, unmount with umount /mnt.
7. Bind‑mount a directory to a new location
The -B option creates an additional mount point that references the same filesystem: # mount -B /mydata /mnt Verification:
# mount | grep /mydata
/dev/sda6 on /mydata type ext2 (rw)
/mydata on /mnt type none (rw,bind)Changes made under either path are reflected in the other.
8. Move a mount point to another directory
Using -M, you can relocate an existing mount tree: # mount -M /mydata /mnt/ After the move, the original mount point no longer appears.
9. Mount without writing to /etc/mtab
The -n option performs a mount that does not record an entry in /etc/mtab: # mount -n /dev/sda6 /mydata Consequently, mount | grep /mydata and cat /etc/mtab | grep /mydata show nothing.
10. Mount read‑only or read‑write
Read‑only can be requested with -r (alias of -o ro). For ext4 you may also need ro,noload to prevent writes on a dirty filesystem:
# mount /dev/sda6 /mydata -r
# mount /dev/sda6 /mydata -t ext4 -o ro,noloadRead‑write is the default; you can explicitly use -w if desired.
11. Remount an already mounted filesystem
To change mount options of an existing mount, use the remount option: # mount -o remount,rw /mydata Afterwards the mount shows (rw) instead of (ro,noload).
12. Mount an ISO image
Loop‑mount an ISO file to a directory:
# mount -t iso9660 -o loop pdf_collections.iso /mntNow the contents of the ISO are accessible under /mnt.
13. Unmount multiple mount points at once
Provide several targets to umount in a single command:
# umount /mydata /backup14. Lazy unmount
The -l (lazy) option detaches the filesystem immediately but delays cleanup until all references are closed:
# umount -l /mydata15. Force unmount
If a device is busy, -f forces the unmount (use with caution): # umount -f /mnt When -f fails, you can identify the holding processes with ps or fuser and terminate them before retrying.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
