LinuxLow

Mounting Disks in Linux: A Complete Beginner's Guide

In this guide, you'll learn how to mount disks in Linux using the command line, configure automatic mounting via fstab, and troubleshoot common permission issues.

Updated at February 17, 2026
10-15 min
Easy
FixPedia Team
Применимо к:Ubuntu 22.04+Debian 11+CentOS 8+Fedora 36+

Introduction / Why This Is Needed

Disk mounting is the process that makes a file system on a physical storage medium (HDD, SSD, flash drive) accessible within Linux's unified directory hierarchy. Without this step, the operating system cannot read or write data to the device. This guide will help you:

  • Connect any new or external disk manually.
  • Configure automatic mounting at system boot.
  • Understand key concepts: devices, mount points, file systems.

After completing this, you will be able to work with data on any connected disk just like folders in your home directory.

Requirements / Preparation

Before you begin, ensure that:

  1. You have administrator privileges (access to sudo).
  2. The disk is physically connected and detected by the system.
  3. Utilities for working with file systems are installed (they are usually present by default). For NTFS, you may need the ntfs-3g package:
    # For Debian/Ubuntu
    sudo apt update && sudo apt install ntfs-3g
    
    # For CentOS/Fedora
    sudo dnf install ntfs-3g
    
  4. A mount point (an empty directory) has been created. Typically, /mnt or /media is used.

Step-by-Step Instructions

Step 1: Identify the Device and Its Partitions

First, you need to find out how the system names your disk. The simplest way is the lsblk command, which shows all block devices as a tree.

lsblk

Example output:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238,5G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0   238G  0 part /
sdb      8:16   0   1,8T  0 disk 
└─sdb1   8:17   0   1,8T  0 part 

Here, sdb1 is the first partition on the second disk (sdb). Pay attention to the SIZE to avoid confusing devices.

Alternative: sudo fdisk -l provides more detailed information, including the file system type.

Step 2: Create a Mount Point

A mount point is a regular folder, but it must exist before mounting. Create it in a standard location (/mnt) or anywhere else convenient.

sudo mkdir -p /mnt/mydata

The -p flag allows you to create the entire directory chain if it doesn't exist and doesn't cause an error if the directory already exists.

Step 3: Mount the Disk Temporarily (for Testing)

Now, connect the disk to the mount point. Use mount, specifying the device and the mount point.

sudo mount /dev/sdb1 /mnt/mydata

Important: If the file system is not ext4 (e.g., ntfs, exfat, fat32), specify its type explicitly using the -t flag. Often for NTFS, the ntfs-3g driver is required:

sudo mount -t ntfs-3g /dev/sdb1 /mnt/mydata

After this, the disk's contents will be accessible in /mnt/mydata. You can verify with ls /mnt/mydata.

Step 4: Configure Automatic Mounting via fstab

To have the disk mount automatically at every boot, add an entry to the configuration file /etc/fstab (file systems table).

Open the file for editing:

sudo nano /etc/fstab

Add a new line to the end of the file. The line format is:

<device>   <mount_point>   <fs_type>   <options>   <dump>   <pass>

Example for an ext4 partition:

/dev/sdb1   /mnt/mydata   ext4   defaults   0   2

Example for NTFS with correct permissions for the current user (UID 1000, GID 1000):

/dev/sdb1   /mnt/mydata   ntfs-3g   defaults,uid=1000,gid=1000,dmask=022,fmask=133   0   0
  • uid and gid — the user and group IDs that will receive permissions on files. You can find them with the id command.
  • dmask and fmask — permission masks for directories and files (022 = rwxr-xr-x, 133 = rw-r--r--).

Tip: Instead of /dev/sdb1, you can use a UUID (a unique identifier) that won't change if you reconnect cables. Find the UUID with sudo blkid. Example:

UUID=1234-ABCD   /mnt/mydata   ntfs-3g   defaults   0   0

Save the file (Ctrl+O, Enter, Ctrl+X in nano). To apply the changes without rebooting, run:

sudo mount -a

If the command completes without errors, the configuration is correct.

Step 5: Verify the Result

  1. Temporary mount: mount | grep mydata or df -h | grep mydata.
  2. Automount: Reboot the system (sudo reboot). After logging in, run df -h again and ensure your disk is in the list and mounted at the correct point.
  3. Permissions: Try creating a file in the mount point under your own name: touch /mnt/mydata/test.txt. If it works — the permissions are set correctly.

Potential Issues

  • mount: /mnt/mydata: special device /dev/sdb1 does not exist.
    • Cause: Incorrect device name. Double-check with lsblk.
    • Solution: Specify the correct partition path (e.g., /dev/nvme0n1p2 for NVMe).
  • mount: /mnt/mydata: wrong fs type, bad option, bad superblock...
    • Cause: The file system type (-t) is not specified or is incorrect, the file system is corrupted, or the required driver is missing.
    • Solution: Identify the FS with sudo fdisk -l or blkid. Install the appropriate package (e.g., exfat-utils for exFAT).
  • Permission denied when writing to NTFS/FAT.
    • Cause: By default, these file systems do not have Linux permission concepts. All files belong to root.
    • Solution: Use the uid, gid, umask options in fstab or the mount command, as shown in Step 4. For FAT, utf8=1,uid=1000 may also help.
  • Disk does not mount automatically after editing fstab.
    • Cause: A syntax error in fstab or an incorrect UUID/device.
    • Solution: Run sudo mount -a — it will show the specific line with an error. Fix it. Ensure the mount point exists.
  • Target is busy when trying to unmount.
    • Cause: Someone (you or a program) is using files in that mount point.
    • Solution: Close all open files and terminals in that directory. You can use lsof +D /mnt/mydata to find the processes.

F.A.Q.

How to check which disks and partitions exist in the system?
What is a mount point and why is it needed?
How to make a disk mount automatically at boot?
What to do if there's no write permission when mounting an NTFS disk?

Hints

Identify the device and its partitions
Create a mount point
Mount the disk temporarily
Set up automatic mounting via fstab
Verify the mount

Did this article help you solve the problem?

FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community