Quick take: Use sudo mount /dev/sdb1 /mnt/data to attach a filesystem and sudo umount /mnt/data to detach it. Run mount alone to list everything currently mounted, and edit /etc/fstab to make mounts permanent.
Introduction
In Linux everything lives under a single directory tree, and the mount command is how you attach a filesystem — a disk partition, USB drive, or network share — to a directory within it. umount detaches it again. Understanding mounting is essential for adding storage, accessing removable media, and managing servers.
This guide covers mounting and unmounting devices, listing current mounts, and making mounts survive a reboot with /etc/fstab.
Syntax
The basic syntax of the mount and umount command is:
mount [OPTIONS] DEVICE DIRECTORY
umount [OPTIONS] DEVICE|DIRECTORYMaking Mounts Permanent with fstab
Mounts made with the mount command are temporary and vanish at reboot. To mount a filesystem automatically at boot, add a line to /etc/fstab. Identify the device by its stable UUID (from lsblk -f or blkid) rather than /dev/sdb1, which can change between boots.
# /etc/fstab line
UUID=1234-ABCD /mnt/data ext4 defaults 0 2
# Test the fstab entry without rebooting
sudo mount -aAlways test with sudo mount -a after editing fstab — a bad entry can prevent the system from booting.
Common Options and Parameters
The most useful options and parameters for the mount and umount command:
| Option | Description |
|---|---|
| mount | With no arguments, list all mounted filesystems. |
| -t TYPE | Specify the filesystem type (ext4, xfs, ntfs, vfat). |
| -o OPTS | Mount options (ro, rw, noexec, defaults). |
| -a | Mount everything listed in /etc/fstab. |
| umount -l | Lazy unmount — detach when no longer busy. |
| umount -f | Force unmount (use with care). |
| --bind | Mount an existing directory at another location. |
Practical Examples
Real mount and umount commands you can run today:
# List everything currently mounted
mount | column -t
# Mount a partition
sudo mount /dev/sdb1 /mnt/data
# Mount a USB drive read-only
sudo mount -o ro /dev/sdc1 /mnt/usb
# Unmount it
sudo umount /mnt/data
# Find the device for a label/UUID
lsblk -f
# Mount everything defined in fstab
sudo mount -aTips and Best Practices
- Identify devices with
lsblk -f, which shows partitions, filesystem types, labels, and UUIDs in one view. - If
umountsays the device is busy, find what is using it withlsof /mnt/dataor useumount -lfor a lazy unmount. - In
/etc/fstab, reference filesystems by UUID, not device name, so mounts stay correct even if disk order changes.
Final Thoughts
mount and umount attach and detach filesystems within Linux's single directory tree — essential for adding disks, using USB drives, and managing storage. Use lsblk -f to identify devices, umount safely before removing media, and /etc/fstab (by UUID) to make mounts permanent. Always test fstab changes with mount -a.
FAQ: mount and umount Command in Linux
How do I mount a drive in Linux?+
Create a mount point (sudo mkdir /mnt/data) and run sudo mount /dev/sdb1 /mnt/data. Use lsblk -f first to find the right device name and filesystem type.
How do I unmount a drive?+
Use sudo umount /mnt/data (or the device name). If it reports the device is busy, close any programs using it or check with lsof, then try again.
How do I see what is currently mounted?+
Run mount with no arguments, or pipe it through column -t for readability. lsblk also shows mounted filesystems in a clear tree.
How do I make a mount permanent?+
Add an entry to /etc/fstab using the filesystem's UUID (from lsblk -f or blkid), then test it with sudo mount -a before rebooting.
Why does umount say the device is busy?+
A process has a file open on the mount or a shell is sitting inside it. Find the culprit with lsof /mnt/point, cd out of the directory, or use umount -l for a lazy unmount.
Need help with Linux servers or infrastructure?
Work directly with Muhammad Irfan Aslam for Linux, Ubuntu, Docker, DevOps, cloud, CI/CD, or infrastructure support.
Hire Me for Support