• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

The Linux Mount Command – Everything You Need To Know

CJ Saathoff

Published on: December 7, 2023

Categories: Linux Command Line 0

On Linux and Unix based systems everything is made up of files and folders. To visualize this you can think of it as a directory tree where the further go down the tree the more things branch out. This file hierarchy starts at / which is also refereed to as the root directory and spreads out from there. This means that disks and filesystems are mounted to sub-directories somewhere on this tree.

The Mount command is used to mount filesystems located locally and remotely to a location within this tree so it can be used for storage.

Be aware that mounting a file system is an administrator task so there are points that will require the ability to login as the root user or sudo privileges. If you are unable to directly login as root try using sudo -i before any file system mounting.

Table of Contents
  • Listing Mounted File Systems
  • Mounting Local File Systems
    • When Working With Remote File Systems
  • Common Mount Flags
  • Mounting A File System On Boot
    • When Working With Remote File Systems
  • How To Unmount A File System
  • Additional Information

Listing Mounted File Systems

Lets start by look at the currently mounted file systems as it is always good to verify what disks/storage is mounted before attempting to make any changes.

Using the mount command itself we can use the mount command with the -l flag:

mount -l

That said it is likely depending on the OS/Distribution you happen to run the command on, the output may be a bit hard to understand due to extraneous information. If that ends up being the case my recommendation is to use the lsblk command as it list the file systems that are on block devices, in other words physical disks. That would look like the command below:

lsblk
Image of lsblk command output

Some other commands besides the two already discussed that can be used to list mounted file systems have been included below:

cat /proc/mounts      
findmnt
df -h

Mounting Local File Systems

To mount a file system using the mount command we need to first have an empty folder where we can mount to the given file system in to.

It is generally recommended to keep mount points in /mnt or /media though there are exceptions for example were a user mounts something inside of there home directory.

For this example I will use /mnt/point

To create the mount point the command would be as follows

mkdir /mnt/point

Once this is done we need a way to refer to the block device containing containing the file system and data we want to be able to access. We can again use the output from the lsblk command to determine the device names.

For this example lets say the disk we want to mount is located at /dev/sdb and already has a ext4 file system on the block device.

If the disk isn’t using ext4 but make sure to change what is after -t to specify the correct filesystem type.

mount -t ext4 /dev/sdb /mnt/point

To verify the disk has been mounted you will want to run your choice of command from the section above.

Also be aware that at this point the mount will will not persist across reboots.

When Working With Remote File Systems

The first thing to be aware of when mounting a remote file system is that we need to ensure the software package is installed so the system can communicate over the remote protocol used on the end serving up the storage.

For example when using NFS (network file system) that would be the NFS client package. And the filesystem type is nfs.

Common Mount Flags

-o : Used for specify mount options

-t : Used to specify the file system type

-r : Used to mount as read only

-w : Used to specify read-write which is defaulted to unless otherwise specified

-a : Tells the system to try and mount all the file systems listed in /etc/fstab

Mounting A File System On Boot

To mount a file system at boot we need to add the entry to the /etc/fstab file.

Though before we get started we want the Universally unique identifier (UUID) for the disk as we want to reference this disk in place of the device name /dev/sdb.

To do that we want to use the blkid command followed by the device name.

blkid /dev/sdb
Output from the blkid command

With that we want to copy what is in between the parentheses after UUID=. With that in hand we can get started on creating the fstab configuration entry

Paste the UUID after UUID= and you have a basis fstab entry and if you happen to be using something other than ext4 please make sure to modify that as well.

UUID= /mnt/point   ext4    defaults        0       0

For more info on what configuration options you can use in fstab you there is a man page entry for fstab.

Once the necessary changes have been made append to the /etc/fstab configuration file using a text editor.

Now we will want to test to make sure the disk mounts.

If the disk has already been mounted first you will want to umnount it see that section below.

Once the disk has been unmounted it is recommend testing with mount -a or mount /mnt/point if this works you will see the disk mounted automatically.

If the this worked the last test is to do a reboot to make sure that the disk gets mounted.

When Working With Remote File Systems

You will want to use different fstab configuration options as the defaults could cause issues when trying to boot of the system.

For example when using NFS try starting with the following and modify as needed.

//<remote-server>/<remote-share> /mnt/remote nfs defaults,nofail 0 0

How To Unmount A File System

To unmounting a file system you simply run the umount command and append the path to the mount point.

To umnount a disk mounted at /mnt/point for example this is the command

umount /mnt/point

Some other common flags for the umount command you may want/need have been included below.

-f : Force unmounting, even if there are processes using the file system.

-v : Be verbose and print out information about each file system being unmounted.

-t : Specify the file system type.

-l : detach the filesystem now, clean up things later also known as lazy unmount

-h : Print help information.

Additional Information

As with almost anything Linux related there is quite a few ways to accomplish the same thing. That said I recommend using caution if you haven’t tested or know for certain before running commands in production.

In addition to online resources some additional resources that you can be found on a Linux System have been listed below if you need help verifying what a command line command or flag does:

  • The commands –help flag
  • The man page `man command` or info page `info command`
CJ Saathoff

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.

Related Posts

How to Use Dig to Specify a DNS Server

Dig is a Linux tool that allows you to query nameservers. It also allows you to query specify nameservers for debugging.

When to Use Here-String vs Heredoc in Bash

Heredoc and Here-string are both ways to input strings into commands that read from stdin. Here's the difference between them.

Echo vs Printf in Bash: What’s the Difference?

Echo and printf can both be used in bash for outputting text. However, echo is for quick output, whereas printf gives you more power.

How to Use Git Rebase Interactive to Manage Commits

As a project progresses, commits can get messy. The git rebase interactive feature allows you to keep a clean commit history.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA