How to Mount and Unmount Drives
Learn how to mount and unmount drives on Linux using mount, umount, and /etc/fstab with UUIDs for reliable, persistent automounting across reboots.
Before you start
- ▸A running Linux system with sudo or root access
- ▸At least one additional drive or partition to mount (internal, USB, or a second disk)
- ▸Basic familiarity with the terminal and a text editor such as nano or vim
Mounting a drive means making its filesystem accessible at a directory path—called a mount point—so the kernel can read and write to it. Linux does not automatically expose storage devices the way Windows does with drive letters; you control where and how each device appears in the filesystem tree. Understanding mount, umount, and /etc/fstab is fundamental to managing any Linux system.
Understanding Block Devices and Mount Points
Every storage device appears under /dev as a block device. A typical SATA or NVMe drive might be /dev/sda or /dev/nvme0n1; partitions are numbered, e.g. /dev/sda1, /dev/sda2. USB drives usually appear as /dev/sdb or higher. A mount point is simply an empty directory you attach the filesystem to.
Use lsblk to see all block devices and their current mount status:
lsblk -f
The -f flag adds filesystem type and UUID columns. Output will vary by machine but looks roughly like:
# NAME FSTYPE LABEL UUID MOUNTPOINT
# sda
# ├─sda1 vfat ABCD-1234 /boot/efi
# └─sda2 ext4 a1b2c3d4-... /
# sdb
# └─sdb1 ext4 e5f6a7b8-... (blank = not mounted)
Mounting a Drive Manually
Step 1: Identify the partition and filesystem
Run lsblk -f or blkid (as root) to confirm the device name and filesystem type before mounting anything.
sudo blkid /dev/sdb1
Step 2: Create a mount point
Pick or create a directory. Common conventions are /mnt for temporary mounts and /media for removable media, though you can use any path.
sudo mkdir -p /mnt/mydrive
Step 3: Mount the filesystem
Use mount with the device path and the mount point. Specify the filesystem type with -t if auto-detection fails, but usually it is not required.
sudo mount /dev/sdb1 /mnt/mydrive
For a specific filesystem type (e.g. exFAT for a USB drive formatted on Windows):
sudo mount -t exfat /dev/sdb1 /mnt/mydrive
exFAT support requires the exfatprogs package (Debian/Ubuntu) or exfatprogs/fuse-exfat (Fedora/Arch).
Step 4: Verify the mount
Confirm the drive is accessible:
mount | grep sdb1
ls /mnt/mydrive
Unmounting a Drive
Always unmount a drive before physically removing it. This flushes write caches and prevents data corruption.
sudo umount /mnt/mydrive
You can also unmount by device path:
sudo umount /dev/sdb1
If you get "target is busy", a process is still using the mount point. Find and stop it:
lsof +D /mnt/mydrive
Then kill or close the offending process and retry umount.
Persistent Mounts with /etc/fstab
Manual mounts do not survive a reboot. To mount a drive automatically at boot, add an entry to /etc/fstab. A broken fstab can prevent the system from booting, so back it up before editing and use UUIDs rather than device names.
Why UUIDs instead of /dev/sdX names
Device names like /dev/sdb are assigned by the kernel at boot and can change if you add or remove hardware. A UUID is permanently tied to the filesystem and never changes unless you reformat. Get the UUID of your partition:
sudo blkid -s UUID -o value /dev/sdb1
fstab entry format
Each line in /etc/fstab has six space-separated fields:
| Field | Example | Meaning |
|---|---|---|
| Device | UUID=e5f6a7b8-... | What to mount |
| Mount point | /mnt/mydrive | Where to mount it |
| Type | ext4 | Filesystem type |
| Options | defaults | Mount options (comma-separated) |
| Dump | 0 | Backup flag (use 0) |
| Pass | 2 | fsck order (0=skip, 1=root, 2=others) |
Adding a persistent mount
Back up fstab first, then open it with your editor:
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Add a line like this at the bottom (replace the UUID with your own from blkid):
UUID=e5f6a7b8-0000-0000-0000-000000000001 /mnt/mydrive ext4 defaults 0 2
For a NTFS drive (common for Windows data partitions), use ntfs3 (kernel driver, available since Linux 5.15) or ntfs-3g (FUSE, older but widely available):
UUID=ABCD1234ABCD1234 /mnt/windows ntfs3 defaults,uid=1000,gid=1000 0 0
For a vfat/FAT32 USB drive with proper permissions for a regular user:
UUID=ABCD-1234 /mnt/usb vfat defaults,uid=1000,gid=1000,umask=022 0 0
Testing the fstab entry without rebooting
Mount everything listed in fstab that is not already mounted. This validates your new entry immediately:
sudo mount -a
If the command returns no errors and ls /mnt/mydrive shows your files, the entry is correct. If it fails, fix the entry before rebooting.
Automounting Removable Drives (Desktop Systems)
On desktop systems, udisks2 and your desktop environment handle automounting of USB drives and optical media without any fstab entries. The udiskie tool is popular on minimal setups (tiling window managers, etc.):
# Debian/Ubuntu
sudo apt install udiskie
# Fedora
sudo dnf install udiskie
# Arch
sudo pacman -S udiskie
Run udiskie & in your session startup, and removable media will mount automatically under /run/media/$USER/. GNOME and KDE do this out of the box through their integration with udisks2; no extra packages are needed.
Useful Mount Options
- defaults — equivalent to
rw,suid,dev,exec,auto,nouser,async. Fine for most internal drives. - ro — read-only. Useful for mounting backups or untrusted media.
- noatime — do not update access timestamps on reads. Reduces write wear on SSDs and flash storage.
- nofail — do not block boot if the device is absent. Essential for external drives in fstab.
- x-systemd.automount — mount on first access rather than at boot. Good for NAS or slow drives.
Example fstab line combining nofail and noatime for an external backup drive:
UUID=e5f6a7b8-0000-0000-0000-000000000001 /mnt/backup ext4 defaults,noatime,nofail 0 2
Troubleshooting
- "wrong fs type, bad option, bad superblock" — the filesystem type is wrong or the partition is damaged. Confirm with
blkidand trysudo fsck /dev/sdb1(only on unmounted filesystems). - Mount point does not exist — create the directory with
sudo mkdir -p /mnt/mydrivebefore mounting. - System drops to emergency shell at boot after fstab edit — boot from a live USB, mount your root partition, restore
/etc/fstab.bakover/etc/fstab, and reboot. - Permission denied accessing mounted drive — for FAT/NTFS filesystems, add
uid=andgid=options matching your user ID (id -uandid -g). For ext4, usesudo chownon the mount point after mounting. - exFAT or NTFS not recognized — install the required userspace tools:
exfatprogsorntfs-3gfor your distro.
Frequently asked questions
- What is the difference between /mnt and /media?
- /mnt is the traditional location for manually mounted temporary filesystems. /media is used by desktop automounters (udisks2, GNOME, KDE) for removable media like USB drives and optical discs. Both are just conventions; the kernel does not treat them differently.
- Why should I use UUID instead of /dev/sdb1 in fstab?
- Kernel device names like /dev/sdb are assigned at boot based on detection order, which can change when you add or remove drives. A UUID is written into the filesystem at format time and never changes unless you reformat, making fstab entries reliably point to the right partition.
- What does the nofail fstab option do and when should I use it?
- nofail tells the boot process to continue even if the device is absent or fails to mount. You should use it for any external, removable, or optional drive in fstab; without it, a missing drive will drop your system into an emergency shell at boot.
- Can I mount a drive without root/sudo privileges?
- By default, no. However, adding the `user` option to an fstab entry allows any user to mount and unmount that specific device. Desktop environments handle this transparently via udisks2 with polkit policies, which is why plugging in a USB drive works without sudo on a typical desktop.
- How do I check what is currently mounted on my system?
- Run `mount` with no arguments for a full list, `lsblk -f` for a device-tree view including UUIDs and mount points, or `findmnt` for a cleaner tree-formatted output. All three are available on any standard Linux installation.
Related guides
Back Up Linux with Borg or restic
Set up encrypted, deduplicated backups with BorgBackup or restic: local and remote repos, retention pruning, restoring files, and systemd timer scheduling.
How to Check Disk Health with SMART
Learn to use smartctl to read SMART attributes, run drive self-tests, and identify early warning signs of HDD and SSD failure before data loss occurs.
Debug systemd Units that Won't Start
Learn a repeatable workflow to debug systemd services that won't start: status output, journalctl, systemd-analyze verify, and safe override.conf patches.
Linux Server Disaster Recovery Checklist
A practical Linux server disaster recovery checklist: what to back up, RTO/RPO planning, immutable off-site copies, automated restore drills, and verification.