WTF Is “Mounting a Filesystem?”

If you are anything like me, right now you’re frustrated.  You’re thinking “oh great.  More terminology.  More concepts.”  The newest obstruction is mounting filesystems.

You’ve read our article on partitions and filesystems, but we’ve never explained mounting very well.  It’s a commonly used word in the Linux world, but it’s another concept everyone expects you to just know.  Fear not!  I’ll explain!

 

What is a Filesystem

Momentarily.  I’ll explain momentarily.  First a really quick review on filesystems.  A filesystem is a method for organizing files on a storage device.  It is essentially a list of files, their properties, and their physical location on the storage device.  There are many filesystems, each with their own strengths, weaknesses, and features.  Windows computers typically use the NTFS filesystem, Apple computers the HFS+ filesystem, and, as is often the case with Linux, there are a lot of competing choices for Linux filesystems.  One of the more popular choices is ext4.

Regardless of the specific filesystem in use, the computer needs a way to access that filesystem.  That’s where mounting comes in.

 

Accessing Filesystems

Linux computers access filesystems by attaching, or mounting them to a directory.  Mounting simply means “making a filesystem accessible at a certain point in the currently accessible directory tree.”

If you’re familiar with Microsoft Windows, then this is a new concept.  Windows automatically mounts filesystems it recognizes and gives it a letter designation (e.g. the C drive) under the “This PC,” “Computer,” or “My Computer” heading.

A listing of the "This PC" page in the Windows 8 file explorer.

Linux doesn’t use the letter designation naming convention, and doesn’t decide where to mount things for you.  You pick a directory where you want the filesystem accessible.  The directory being mounted to is called the “mount point.”  This mount point becomes a doorway leading to the storage device.

Mounting to /mnt.

In the diagram above, we have two mounted filesystems.  The first, colored green, is mounted to root.  Root is a constant mount point provided by Linux operating system that must have a filesystem mounted there.  The second filesystem, colored yellow,  is mounted to the /mnt directory.

 

Using the ‘mount’ and ‘umount’ Commands

The ‘mount’ terminal command is used to mount filesystems.  The opposite of mount is umount (notice the missing ‘n’, it is not unmount, it is umount).

I am going to review basic uses of these commands.  However, they are complex, and I recommend you peruse their man pages:

List Mounted Filesystems

Using the mount command with no arguments or switches will list mounted filesystems.  Simply type:

 

Results of mount command with no arguments or switches.

 

Mount a Filesystem

When the command is combined with arguments and switches, the command can mount filesystems.  Typically, mounting a filesystem is as simple as providing two arguments.  The first argument is the device file (entry in /dev).  The second argument is the desired mount point.  For example, if I want the first partition, on the second hard disk, mounted to the /mnt directory, I would use the following command:

 

The biggest challenge with this command is finding what device file you want.  The quickest method for finding this information is using the terminal command parted -l.

*NOTE:  It is likely that these commands will require superuser permissions.

Result of parted -l command

Simply combine the disk path and the partition number.  /dev/sdb1 for example.  You can also find this information using partition management software like the popular GParted tool.

gparted

 

 Unmount a Filesystem

To unmount a mounted filesystem, use the  umount command.  Usually all that command needs is the mount point as an argument.

 

Does This Have a Permanent Mount Point in Your Memory Now?

Again, I only provided simple examples and you should read up on the command details.  However, the information and examples presented here are more then enough to get you through most mounting situations.  

If you read or hear of any great explanations or examples of mounting filesystems, let us know in the comments!  We’re always looking for ways to improve.

Written By

John is a sailing instructor and mechanical engineering student who happens to be a computer geek. To find more information about John, visit his website or find him on social media by clicking on the icons below.

Facebook Twitter Google+ Website

Tags: , ,

Join the Conversation!