Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Mount Storage Linux: Commands and Examples

· 7 min read · Home Tech

In this article
  1. What Exactly Does “Mounting” Mean?
  2. How Do I Mount a Storage Device in Linux?
  3. How Do I Mount a Drive Automatically at Boot?
  4. What Are the Common Mount Options I Should Know?
  5. Why Do I Get “Permission Denied” When Mounting?
  6. What Are the Signs That a Mount Failed or Is Wrong?
  7. How Do I Unmount a Drive Safely?
  8. What About Mounting Network Storage (NFS, SMB)?
  9. Mounting for Beginners: Quick Reference Table
  10. What to Do When You Can’t Mount a Windows (NTFS) Drive?
  11. Common Mistakes and How to Avoid Them
  12. Mounting for Large Storage and Multiple Drives
  13. Final Checks Before You Rely on a Mount

The command to mount storage in Linux is mount, and the basic syntax is sudo mount /dev/sdX1 /mnt, where /dev/sdX1 is the storage device and /mnt is the directory where you attach it. For example, to mount a USB drive that appears as /dev/sdb1, you would run sudo mount /dev/sdb1 /mnt/usb after creating the mount point with sudo mkdir /mnt/usb. This attaches the filesystem on that device to your directory tree, making its files accessible under /mnt/usb.

What Exactly Does “Mounting” Mean?

Mounting is the process of making a storage device’s filesystem available at a specific directory, called a mount point. Linux treats everything as files, and a device like a hard drive or USB stick is not directly browsable until you attach it to an empty directory. Once mounted, the device’s contents appear inside that directory, and you can read, write, and run programs from it as if it were part of your main filesystem.

You can see what is currently mounted with mount (no arguments) or df -h, which shows mounted filesystems and their used/free space. Unmounting is done with umount /mnt/usb (note the spelling: no “n” after the “u”). Always unmount before physically disconnecting a device to avoid data corruption.

How Do I Mount a Storage Device in Linux?

Follow these steps to mount a typical internal or external drive:

  1. Identify the device – Run lsblk to list block devices. Look for entries like sda, sdb, etc., with partitions like sda1, sda2. The size column helps you spot the right drive (e.g., a 16GB USB stick).
  2. Create a mount point – This is just an empty directory. Use sudo mkdir /mnt/mydrive (or any path you prefer, like /media/mydrive).
  3. Mount the filesystem – Run sudo mount /dev/sdb1 /mnt/mydrive. Replace sdb1 with your device and partition.
  4. Verify – Run df -h | grep mydrive or ls /mnt/mydrive to see the contents.

If you get an error like “wrong fs type”, you may need to specify the filesystem type with -t, for example sudo mount -t vfat /dev/sdb1 /mnt/mydrive for FAT32 USB sticks, or sudo mount -t ntfs-3g /dev/sdb1 /mnt/mydrive for NTFS drives. Most modern distributions auto-detect the type, so this is rarely necessary.

What If I Don’t Know the Device Name?

Use lsblk – it shows a tree of all storage devices with sizes and mount points. Another useful command is sudo fdisk -l, which lists partitions and their filesystem types. If you just plugged in a USB drive, it often appears as sdb or sdc; check the dmesg tail (dmesg | tail) to see the kernel messages that name the new device.

How Do I Mount a Drive Automatically at Boot?

To mount a drive every time you start your computer, add an entry to the /etc/fstab file. This file defines permanent mounts. First, find the device’s UUID (a unique identifier) with sudo blkid /dev/sdb1 – it will output something like UUID="1234-5678". Then edit /etc/fstab (as root) and add a line like:

UUID=1234-5678  /mnt/mydrive  ext4  defaults  0  2

Replace ext4 with your filesystem type (e.g., vfat for FAT32, ntfs-3g for NTFS). The defaults option is fine for most cases; use noauto if you want to mount manually but with a shortcut. After editing, test with sudo mount -a (mounts everything in fstab) – if it works, the drive will mount at boot.

Caution: A wrong fstab entry can prevent your system from booting. Always double-check the UUID and filesystem type. If you get stuck, boot into recovery mode or use a live USB to fix the file.

What Are the Common Mount Options I Should Know?

Mount options are added after -o in the command line or in the options field of fstab. Here are the most useful ones:

  • ro – Mount read-only (prevents accidental writes).
  • rw – Mount read-write (default).
  • noexec – Prevent execution of binaries on that filesystem (good for security).
  • nosuid – Ignore setuid bits (also security).
  • uid=1000,gid=1000 – Set the owner and group for files on FAT/NTFS drives (replace 1000 with your user ID, found with id -u).
  • umask=022 – Set default permissions for files on FAT/NTFS (022 gives rwxr-xr-x).

For example, to mount a USB drive read-only with noexec: sudo mount -o ro,noexec /dev/sdb1 /mnt/usb. You can see all options in the mount man page (man mount).

Why Do I Get “Permission Denied” When Mounting?

Mounting requires root privileges, so you need sudo for the mount command. If you get “Permission denied” even with sudo, the device might already be mounted (check with mount or lsblk). Another reason is that the mount point directory has restrictive permissions – make sure it exists and is empty. Also, some filesystems (like NTFS) may need the ntfs-3g driver installed; if it’s missing, you’ll see an error about unknown filesystem type.

If you want to allow a regular user to mount a specific device without sudo, you can add an fstab entry with the user option (e.g., UUID=... /mnt/usb vfat user,noauto 0 0). Then the user can run mount /mnt/usb without sudo.

What Are the Signs That a Mount Failed or Is Wrong?

Look for these clues:

  • Error message – “mount: /mnt/mydrive: wrong fs type” means the filesystem type is not recognized; try specifying it with -t.
  • Nothing appears in the mount point – The directory is empty; check if the device is actually mounted with mount | grep mydrive.
  • “Device or resource busy” – Something is using the filesystem (e.g., a terminal is in that directory). Close the process or change directory before unmounting.
  • “Not a directory” – The mount point path is wrong; ensure it exists and is a directory.
  • System boots to emergency mode – This often means an fstab entry is invalid. Boot from a live USB and fix the line.

Rule of thumb: always check lsblk to see if the device is already mounted (it will show a mount point). If it is, unmount it first with sudo umount /dev/sdb1 or sudo umount /mnt/mydrive before trying again.

How Do I Unmount a Drive Safely?

Use sudo umount /mnt/mydrive or sudo umount /dev/sdb1. If you get “target is busy”, find the process using it with lsof /mnt/mydrive or fuser -vm /mnt/mydrive, then stop that process. For external drives, you can also use sudo eject /dev/sdb if it’s a removable device. Always unmount before unplugging to avoid data loss.

What About Mounting Network Storage (NFS, SMB)?

Network shares are mounted similarly. For an NFS share: sudo mount -t nfs server:/export/path /mnt/nfs. For a Windows/SMB share: sudo mount -t cifs //server/share /mnt/smb -o username=yourname. You’ll be prompted for a password. These can also be added to fstab with the appropriate options (e.g., _netdev to wait for network).

Mounting for Beginners: Quick Reference Table

Here’s a cheat sheet for common scenarios:

TaskCommand
List deviceslsblk
Mount a partitionsudo mount /dev/sdX1 /mnt/point
Mount with filesystem typesudo mount -t vfat /dev/sdX1 /mnt/point
Mount read-onlysudo mount -o ro /dev/sdX1 /mnt/point
Unmountsudo umount /mnt/point
Find UUIDsudo blkid /dev/sdX1
Test fstab entriessudo mount -a

What to Do When You Can’t Mount a Windows (NTFS) Drive?

NTFS drives often need the ntfs-3g package installed. On Debian/Ubuntu, install it with sudo apt install ntfs-3g. After that, mount with sudo mount -t ntfs-3g /dev/sdX1 /mnt/windows. If the drive is hibernated (from Windows Fast Startup), you may get an error; boot into Windows and disable Fast Startup, or force mount with sudo mount -t ntfs-3g -o remove_hiberfile /dev/sdX1 /mnt/windows (use at your own risk – it deletes the hibernation file).

Common Mistakes and How to Avoid Them

  • Using the wrong device name – Always verify with lsblk before mounting; device names can change between reboots.
  • Mounting over a non-empty directory – The mount point must be empty; otherwise the original contents are hidden until unmount.
  • Forgetting to unmount – Unplugging without unmounting can corrupt data. Make it a habit to unmount before removing a drive.
  • Editing fstab without testing – Always run sudo mount -a after editing fstab to catch errors before rebooting.
  • Using mount without sudo – You need root privileges; use sudo.

Mounting for Large Storage and Multiple Drives

If you have many drives, consider using lsblk -f to see filesystem types and UUIDs in one view. For large arrays, you might use LVM or RAID, but that’s beyond basic mounting. For a NAS, use fstab entries with _netdev to avoid boot delays when the network is down. Remember that mounting is temporary unless you add it to fstab; a reboot will undo manual mounts.

If you need to mount an ISO file (an image of a disc), you can do it with sudo mount -o loop file.iso /mnt/iso. This is handy for installing software from images without burning them.

Final Checks Before You Rely on a Mount

After mounting, verify that you can read and write files: touch /mnt/mydrive/test.txt and then ls /mnt/mydrive. Check permissions with ls -l; if you see root as owner and you need your user to write, use the uid and gid options. For a permanent mount, test the fstab entry with sudo mount -a and also reboot once to confirm it works automatically.