mount system

plug it in. tell linux where it goes.

The mount man page is 1,800 lines long. Most of it covers filesystem types you’ll never use. You need about five commands and an understanding of one concept: everything in Linux is a directory.

You plugged in a USB drive. On Windows, it appeared as E:. You opened File Explorer, clicked E:, dragged your files onto it, and ejected it from the system tray. Painless. Automatic. Until the drive letter changed to F: for no reason and now the backup script that was pointed at E: is writing to the wrong place. Or nowhere.

On Linux, there are no drive letters. Every disk, partition, USB drive, network share, and ISO file gets “mounted” to a directory. You decide where. /mnt/usb. /media/backup. /data. Whatever you want. The path never changes unless you change it. Your scripts work forever because the mount point is a name you chose, not a letter the OS assigned randomly.

The trade-off? Linux doesn’t always mount things automatically. Sometimes you have to tell it. That’s what mount is for.

Unless you’re running Windows then wtf none of this applies to you. But hey, come to the dark side, go install WSL2 and you can follow along. We’ll wait. Impatiently.

If you’re lazy like me (all sysadmins are!) then click here for the mount cheat sheet.


See what’s currently mounted

mount

Lists everything that’s mounted. This will be a long list — Linux mounts a lot of virtual filesystems internally. To see just the interesting stuff:

mount | grep "^/dev"

Only real devices. No virtual filesystems, no kernel pseudo-mounts. Just your actual disks and partitions.

lsblk

Even cleaner. Shows block devices in a tree view with mount points. See the lsblk page for details.


Mount a device

sudo mount /dev/sdb1 /mnt/usb

Mounts the partition /dev/sdb1 to the directory /mnt/usb. The directory must exist first — create it with mkdir -p /mnt/usb if it doesn’t.

After mounting, everything on that device appears under /mnt/usb. ls /mnt/usb shows the files on the drive. cp file.txt /mnt/usb/ copies to the drive. The mount point is just a directory.

How to find the device name

Don’t guess. Use lsblk:

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   100G  0 disk
├─sda1   8:1    0    99G  0 part /
└─sda2   8:2    0     1G  0 part [SWAP]
sdb      8:16   1    32G  0 disk
└─sdb1   8:17   1    32G  0 part

sdb1 is the USB drive (32G, removable). sda is your system disk. Don’t mount the wrong one.


Mount with a specific filesystem type

sudo mount -t ntfs-3g /dev/sdb1 /mnt/windows-drive

-t specifies the filesystem type. Usually mount auto-detects, but sometimes you need to be explicit — especially for NTFS (Windows) drives, which need the ntfs-3g driver.

Common filesystem types:

Type What it is
ext4 Standard Linux filesystem.
xfs Common on RHEL/CentOS.
ntfs-3g Windows NTFS (read/write).
vfat FAT32 (USB drives, SD cards).
nfs Network file share.
iso9660 CD/DVD/ISO images.

Mount read-only

sudo mount -o ro /dev/sdb1 /mnt/evidence

-o ro mounts read-only. Nothing can be written, modified, or deleted. Use this for forensics, evidence preservation, or any time you need to look at a drive without accidentally changing it.


Mount an ISO file

sudo mount -o loop disk.iso /mnt/iso

Mounts an ISO image as if it were a physical disc. -o loop tells mount to treat the file as a block device. Browse the contents at /mnt/iso without burning it to a disc or extracting it.


Mount a network share (NFS)

sudo mount -t nfs server:/shared/data /mnt/nas

Mounts a directory from an NFS server. The remote files appear locally at /mnt/nas. Reads and writes go over the network transparently.

Mount a Windows/Samba share

sudo mount -t cifs //server/share /mnt/smb -o username=owner

Mounts a Windows file share (SMB/CIFS). You’ll be prompted for the password.


Remount with different options

sudo mount -o remount,rw /

Changes mount options without unmounting. This example remounts the root filesystem as read-write — useful in recovery mode when the root filesystem starts as read-only.


Make it permanent (fstab)

Everything you mount manually disappears on reboot. To make mounts persistent, add them to /etc/fstab:

sudo vim /etc/fstab
# device                mount-point     type    options         dump  fsck
/dev/sdb1               /mnt/data       ext4    defaults        0     2
//server/share          /mnt/smb        cifs    credentials=/etc/smbcreds  0  0
server:/export          /mnt/nfs        nfs     defaults        0     0

Columns:

  1. Device — partition, UUID, or network path
  2. Mount point — where to mount
  3. Type — filesystem type
  4. Optionsdefaults is usually fine, or ro, noexec, etc.
  5. Dump0 (don’t back up with dump)
  6. Fsck order0 to skip, 1 for root, 2 for others

Use UUIDs instead of device names

Device names like /dev/sdb1 can change if you add or reorder disks. UUIDs don’t:

blkid /dev/sdb1
/dev/sdb1: UUID="a1b2c3d4-e5f6-7890-abcd-ef1234567890" TYPE="ext4"

In fstab:

UUID=a1b2c3d4-e5f6-7890-abcd-ef1234567890  /mnt/data  ext4  defaults  0  2

Test your fstab without rebooting

sudo mount -a

Mounts everything in fstab that isn’t already mounted. If there’s a typo, you’ll see the error now instead of during boot when it might prevent the system from starting.


The flags that actually matter

Flag What it does
-t TYPE Filesystem type (ext4, ntfs-3g, nfs, etc.).
-o OPTIONS Mount options (ro, rw, loop, remount, noexec).
-a Mount all entries in fstab.
-l List mounts with labels.

Common options (-o):

Option What it does
ro Read-only.
rw Read-write (default).
loop Mount a file as a device (ISO images).
remount Change options on an already-mounted filesystem.
noexec Prevent execution of binaries.
nosuid Ignore setuid/setgid bits.

“But it just mounts automatically—”

Sometimes.

“My desktop auto-mounts USB drives.” Desktop environments like GNOME and KDE have auto-mount services. Servers don’t. When you’re SSH’d into a production machine and you need to mount a backup drive, there’s no file manager to do it for you. mount is the tool.

“I just use a file manager.” File managers call mount behind the scenes. They just add a GUI on top. When the GUI breaks — and it will, especially with network shares — you’ll need to know the command that actually does the work.

“Windows drive letters are simpler.” Until you have six drives and the letters shuffle after a reboot. Until D: becomes E: because you plugged in a USB drive first. Mount points are stable by design — you pick the path, it stays the path. /data is /data forever.

“I never touch fstab.” Then every mount you’ve ever done is gone after a reboot. fstab is three lines of configuration that saves you from re-mounting things by hand every time the server restarts. It’s one of the simplest config files on the system.


mount cheat sheet

You made it. Or you skipped straight here. Either way, no judgment. Copy and paste these. Pin them. Tattoo them on your forearm. Whatever works.

What you’re doing Command
Show mounted devices mount | grep "^/dev"
Mount a device sudo mount /dev/sdb1 /mnt/point
Mount read-only sudo mount -o ro /dev/sdb1 /mnt/point
Mount an ISO sudo mount -o loop disk.iso /mnt/iso
Mount NFS share sudo mount -t nfs server:/path /mnt/nfs
Mount SMB share sudo mount -t cifs //server/share /mnt/smb -o username=user
Remount with new options sudo mount -o remount,rw /
Mount all from fstab sudo mount -a
Find device UUID blkid /dev/sdb1

The pattern: sudo mount [-t type] device /mount/point — device goes on the directory. Everything on the device appears under that directory. Unmount with umount /mount/point when you’re done.

Back to the top, you overachiever.