Search Our Database

How to Mount and Unmount Drives Using mount and umount in Linux

Last updated on |
by

Introduction

Managing storage devices is a core task in Linux system administration. Whether dealing with USB flash drives, external hard drives, network shares, or additional internal disks, the ability to mount and unmount these devices manually is crucial. Linux provides two essential command-line utilities for this purpose: mount and umount.

The mount command attaches a storage device or filesystem to a specific directory in the Linux file hierarchy, making its contents accessible to the system. Conversely, the umount command safely detaches the device, ensuring all data is written and the device can be removed or repurposed without data loss.

Understanding how and when to mount or unmount a drive is important for anyone managing Linux systems, from system administrators to developers working on embedded systems or virtual machines. These operations are commonly used when adding new storage to servers, accessing USB drives, configuring backup destinations, or mounting remote filesystems like NFS or CIFS.

This guide outlines the proper usage of mount and umount, including how to identify devices, choose appropriate mount points, manage filesystem types, and handle common errors such as “device is busy” during unmounting. It applies to most modern Linux distributions including Ubuntu, CentOS, AlmaLinux, Debian, and Rocky Linux.

 

Prerequisites

  • A Linux-based operating system (kernel version 3.10 or higher)
  • Root or sudo privileges to perform mount/unmount operations
  • The target drive or device properly connected to the system
  • Filesystem support for the device (e.g., ext4, xfs, vfat, ntfs)

 

Step-by-step Guide

Step 1: Identify Available Drives

Use the  lsblk command to list all block devices and partitions.

lsblk
This command displays devices like lsblk, their size, mount point (if any), and type.
🖊️ Tip: Use blkid or fdisk -l for more detailed information including filesystem types.

 

Step 2: Create a Mount Point

Choose or create a directory where the device will be mounted, e.g., /mnt/usb.

sudo mkdir -p /mnt/usb

 

Step 3: Mount the Drive

Mount the device using the mount command. Replace /dev/sdb1 with your device name and /mnt/usb with your mount point.

sudo mount /dev/sdb1 /mnt/usb

To specify filesystem type (optional but useful for compatibility):

sudo mount -t ext4 /dev/sdb1 /mnt/usb
🖊️ Tip: For NTFS or exFAT filesystems, ensure the required packages like ntfs-3g or exfat-utils are installed.

 

Step 4: Access the Mounted Drive

Once mounted, navigate to the directory and manage files as needed.

cd /mnt/usb

 

Step 5: Unmount the Drive

Before unmounting, ensure no files are being accessed from the mount point.

To unmount:

sudo umount /mnt/usb

Alternatively, unmount by device name:

sudo umount /dev/sdb1
⚠️ Warning: If the device is busy, unmount will fail. Use lsof or fuser to identify and close active processes:
sudo lsof +f -- /mnt/usb

Then try unmounting again after stopping the listed processes.

 

Step 6: Optional – Add Persistent Mount Entry

To mount the drive automatically at boot, edit the /etc/fstab file:

sudo nano /etc/fstab

Example entry:

/dev/sdb1   /mnt/usb   ext4   defaults   0   2
⚠️ Warning: Mistakes in /etc/fstab can prevent the system from booting correctly. Always test with sudo mount -a before rebooting.

 

Conclusion

The mount and umount commands provide essential control over storage devices in Linux. By learning how to properly identify, mount, access, and unmount devices, administrators and users can handle a wide range of storage tasks reliably. For permanent setups, adding entries to /etc/fstab ensures automatic mounting during boot. Proper unmounting is equally important to avoid data loss, especially when dealing with removable media.

Should you have any inquiries about the guidelines, please feel free to open a ticket through your portal account or contact us at support@ipserverone.com. We’ll be happy to assist you further.