Unmounting a drive means telling Linux to stop using it before you remove it

When you plug a drive into a Linux system, the operating system mounts it — connects it to the file system so you can read and write files. Before you unplug that drive, you need to unmount it. Unmounting tells Linux to finish any pending writes, close open files, and release the drive so it is safe to disconnect. If you unplug a drive while it is still mounted, you risk corrupting files and losing data.

The unmount process is straightforward and takes seconds. You use the umount command (note: no "n" in the middle — it is a Unix convention, not a typo). Linux will refuse to unmount a drive if something is still using it, which actually protects you from the mistakes that cause data loss.

Key Takeaways

  • Use the umount command followed by the mount point or device name to safely disconnect a drive from your system.
  • If unmount fails, check what process is using the drive with lsof or fuser, then close that process before trying again.
  • Never unplug a drive while it is mounted, even if unmount appears to have worked — wait for the command prompt to return.
  • External drives and USB sticks must be unmounted before removal, just like internal drives, or you will lose unsaved data.

Find the mount point or device name

Before you can unmount a drive, you need to know where it is mounted. The mount point is the directory where the drive appears in your file system — for example, /mnt/backup or /media/username/external_drive. The device name is the Linux identifier for the physical drive, like /dev/sdb1 or /dev/sdc1.

Open a terminal and type mount with no arguments. This lists every mounted drive on your system, showing both the device name and the mount point. Look for the drive you want to remove — it will usually be an external drive or a second internal drive, not your main system drive. You can also use lsblk to see a tree view of all block devices and their mount points, which is often easier to read.

If you are unsure which drive is which, check the size or label. External drives often show up with labels like "BACKUP" or "EXTERNAL" if you gave them names when you formatted them. Never unmount a drive unless you are certain it is the one you want to remove.

Run the umount command

Once you know the mount point or device name, unmount the drive by typing umount followed by either one. For example, if your external drive is mounted at /mnt/backup, type:

umount /mnt/backup

Or, if you prefer to use the device name:

umount /dev/sdb1

Press Enter and wait for the command prompt to return. If the unmount succeeds, you will see no output — in Linux, silence usually means the command worked. The drive is now safe to unplug. If you see an error message, the unmount failed, and you need to find out why before you disconnect the drive.

Handle "device is busy" errors

The most common unmount error is "device is busy" or "target is busy". This means a file on the drive is still open, or a process is still using it. This is actually a safety feature — Linux is preventing you from yanking the drive while something is reading or writing to it.

To find what is using the drive, use the fuser command. Type:

fuser -m /mnt/backup

This shows the process ID (PID) of anything accessing the drive. You can also use lsof (list open files) to see more detail:

lsof | grep /mnt/backup

Look at the output and identify the process. It might be a file manager window you left open, a terminal with that directory as the current working directory, or a backup process still running. Close the process or change to a different directory in your terminal, then try unmounting again.

Force unmount only as a last resort

If you cannot find what is using the drive, or if the process will not close, you might be tempted to use umount -l (lazy unmount) or umount -f (force unmount). These commands tell Linux to unmount the drive even if something is still using it. Do not do this unless you have no other choice.

A lazy or forced unmount can corrupt files that were in the middle of being written. The drive may appear to be safely disconnected, but data loss can happen silently. If you must force unmount, shut down the system completely before unplugging the drive, or at minimum wait several minutes to let any pending writes finish.

The better approach is to restart your system if you cannot find what is holding the drive open. A restart clears all processes and allows a clean unmount. This takes longer but is far safer than forcing the unmount.

Unmounting drives from the graphical interface

If you use a desktop environment like GNOME, KDE, or Cinnamon, you can unmount drives without touching the terminal. Open your file manager and look for the drive in the sidebar — it usually shows external drives with an eject icon next to the name. Right-click the drive name and select "Eject" or "Unmount". The file manager will unmount the drive and show a notification when it is safe to remove.

This graphical method does the same thing as the umount command — it tells Linux to release the drive. If the eject button is grayed out or does nothing, the drive is still in use, and you should close any open files or windows related to that drive before trying again.

Verify the drive is unmounted before unplugging

After you run umount or click eject, wait for the command prompt to return or for the notification to appear. Do not unplug the drive when ready. Give the system a moment to finish any final writes and confirm the unmount succeeded.

If you want to double-check, run mount again and look for your drive in the list. If it no longer appears, the unmount worked. Now it is safe to physically disconnect the drive. If the drive still appears in the mount list, the unmount failed, and you should investigate the error before unplugging.

Frequently Asked Questions

What happens if I unplug a drive without unmounting it?

Files that were being written to may be corrupted, and you could lose data. The file system may also be left in an inconsistent state, making the drive unreadable until you repair it with tools like fsck. Always unmount first.

Can I unmount my main system drive?

No. Your system drive (usually mounted at /) is in use by the operating system itself and cannot be unmounted while the system is running. Attempting to unmount it will fail with a "device is busy" error, which is the correct behavior.

Do I need to unmount USB sticks the same way as external hard drives?

Yes. USB sticks are mounted just like any other drive, and they must be unmounted before removal. Unplugging a USB stick while it is mounted risks data loss, even though USB sticks are often treated casually.

Why does umount say "permission denied"?

You may not have permission to unmount the drive if another user mounted it or if it is a system-managed mount. Try running the command with sudo: sudo umount /mnt/backup. If you are asked for a password, enter your user password.

Can I unmount a drive that is still being accessed by a running program?

No, and that is intentional. Linux will refuse to unmount a drive if any process is still using it. You must close the program or change its working directory away from the drive before unmounting will succeed.