mount — Mount and Unmount Filesystems

Attach devices, images and network shares to the directory tree: mount, umount, /etc/fstab, bind, loop and tmpfs mounts.

mount attaches devices, partitions, images and network shares to your directory tree – only then do their contents become visible under a path. From USB sticks through ISO loops and bind mounts to NFS and SMB shares, this guide walks you through the commands you reach for daily as an administrator. Take care: mounting over a non-empty directory hides its contents, and a mistake in /etc/fstab can leave your system unbootable. Most actions require sudo.

Basic Mount & Unmount

mount <device> <mountpoint> — Mount a device to a directory.

mount /dev/sdb1 /mnt/usb

mount -t <type> <device> <mountpoint> — Mount with a specific filesystem type.

mount -t ext4 /dev/sdb1 /mnt/data

mount — Show all currently mounted filesystems.

mount

mount | grep <pattern> — Find specific mounts.

mount | grep nfs

umount <mountpoint> — Unmount a filesystem by mount point.

umount /mnt/usb

umount <device> — Unmount a filesystem by device.

umount /dev/sdb1

umount -l <mountpoint> — Lazy unmount: detach immediately, clean up when idle.

umount -l /mnt/stuck

Mount Options

mount -o ro <device> <mountpoint> — Mount read-only.

mount -o ro /dev/sdb1 /mnt/readonly

mount -o rw,noexec,nosuid <device> <mountpoint> — Mount read-write with no exec and no suid.

mount -o rw,noexec,nosuid /dev/sdb1 /mnt/data

mount -o remount,rw <mountpoint> — Remount an already mounted filesystem (e.g., change to rw).

mount -o remount,rw /

mount -o loop <image> <mountpoint> — Mount an ISO or disk image file.

mount -o loop ubuntu.iso /mnt/iso

mount -a — Mount all filesystems from /etc/fstab.

mount -a

Bind Mounts

mount --bind <source> <target> — Bind mount: make a directory available at another location.

mount --bind /var/www /home/user/www

mount --rbind <source> <target> — Recursive bind mount (includes submounts).

mount --rbind /dev /mnt/chroot/dev

mount --bind -o remount,ro <target> — Make a bind mount read-only.

mount --bind -o remount,ro /home/user/www

tmpfs & Special Filesystems

mount -t tmpfs -o size=<size> tmpfs <mountpoint> — Mount a tmpfs (RAM-based filesystem).

mount -t tmpfs -o size=512M tmpfs /mnt/ramdisk

mount -t proc proc /proc — Mount the proc filesystem.

mount -t proc proc /mnt/chroot/proc

mount -t sysfs sysfs /sys — Mount the sysfs filesystem.

mount -t sysfs sysfs /mnt/chroot/sys

Network Filesystems

mount -t nfs <host>:<path> <mountpoint> — Mount an NFS share.

mount -t nfs server:/export/data /mnt/nfs

mount -t cifs //<host>/<share> <mountpoint> -o user=<user> — Mount a Windows/Samba (CIFS/SMB) share.

mount -t cifs //server/share /mnt/smb -o user=admin,password=secret

mount -t cifs //<host>/<share> <mountpoint> -o credentials=<file> — Mount SMB share with credentials file.

mount -t cifs //server/share /mnt/smb -o credentials=/root/.smbcreds

Troubleshooting

findmnt — Show mounted filesystems in tree format.

findmnt

findmnt -t <type> — Show mounts of a specific filesystem type.

findmnt -t ext4

umount -f <mountpoint> — Force unmount (for unreachable NFS mounts).

umount -f /mnt/nfs

fuser -m <mountpoint> — Show processes using a mount point (why umount fails).

fuser -m /mnt/usb

lsof +f -- <mountpoint> — List open files on a mounted filesystem.

lsof +f -- /mnt/data

Conclusion

mount and umount are the backbone of filesystem management on Linux, and most actions require sudo. Before you commit entries to /etc/fstab, test them with mount -a: a typo can hang the system on the next boot, and the nofail option softens that risk. Remember that mounting over a non-empty directory only hides its contents – the data is not gone, merely obscured. When umount fails with "target is busy", lsof and fuser reveal the blocking process; as a last resort, umount -l detaches lazily.

Further Reading

  • Arch Wiki: fstab – how to configure persistent and safe mounts via /etc/fstab
  • man7: mount(8) – the complete reference for the mount command and its options
  • lsblk – list block devices and partitions as a tree
  • fdisk – view and edit partition tables
  • df-du – check disk space and directory sizes