Writing

How to Mount and Unmount a Hard Drive in Ubuntu Linux

Reading time: 1 minute

This guide walks you through identifying, fixing, mounting, and unmounting a hard drive or USB with an NTFS file system on Ubuntu.


Prerequisites

  • A connected external or internal hard drive (e.g., /dev/sdb2)
  • Admin (sudo) access on Ubuntu
  • NTFS-formatted drive (common for Windows drives)

Step 1: Identify the Drive

Open a terminal and list connected drives:

sudo fdisk -l

Look for the correct partition (e.g., /dev/sdb2) based on size and type.

Step 2: Check Drive Info

Use blkid to confirm the filesystem and UUID:

 sudo blkid /dev/sdb2

You should see something like:

 /dev/sdb2: UUID="YOUR UUID WILL APPEAR HERE" TYPE="ntfs" ...

Run ntfsfix to repair common NTFS issues:

 sudo ntfsfix /dev/sdb2

You should see output like:

Mounting volume... OK  
Processing of $MFT and $MFTMirr completed successfully.  
NTFS partition /dev/sdb2 was processed successfully.

Step 4: Create a Mount Point

Choose where to mount the drive:

  sudo mkdir -p /mnt/sdb2

📥 Step 5: Mount the Drive

Mount it using the NTFS file system:

sudo mount -t ntfs /dev/sdb2 /mnt/sdb2

Check if it’s working:

ls /mnt/sdb2

(Optional) Auto-Mount the Drive at Boot

Get UUID:

sudo blkid /dev/sdb2

Edit fstab:

sudo nano /etc/fstab

Add this line(replace UUID iwth your actual one):

  UUID="YOUR UUID NUMBER HERE" /mnt/sdb2 ntfs defaults 0 0

Save and exit. This mounts the drive automatically at boot.

Step 6: Unmount the Drive

When you’re done:

 sudo umount /mnt/sdb2

NB: You can’t unmount a drive while you’re inside it (cd /mnt/sdb2). Always cd away from the mount point before unmounting.

Notes

  1. For FAT32 drives, use -t vfat instead of -t ntfs
  2. For ext4 Linux partitions, omit the -t flag or use -t ext4
  3. You can view mounted drives with lsblk or `df -h

Mounting and unmounting drives in Ubuntu is straightforward once you’re familiar with the tools. This process helps you access and back up data from external or Windows drives on your Linux machine. Thank you!

Originally published on HackMD . Comments and discussion live there.