Jump to content

Linux 101: What is the mount command and how do you use it?


aum

Recommended Posts

Jack Wallen introduces new Linux users to the mount command and how to use it to mount an external drive to the internal file system.

 

linuxhero3.jpg

Image: Jack Wallen

 

Linux is capable of doing all sorts of amazing things, some of which no other operating system on the planet can do. 

 

It's also capable of handling some very basic tasks. One such task is mounting file systems (such as external drives) to the filesystem. This is a crucial feature, otherwise, you wouldn't be able to either expand your storage or attach external data drives. 

 

If you're working with a distribution of Linux that includes a desktop GUI, adding external drives is pretty simple. But what if you're using a GUI-less server? For that, you'll need to make use of the mount command. Mount does exactly what you think it does, it mounts an external drive to your internal filesystem. 

 

But it's not exactly that simple. First off, you have to have a directory on the internal file system to serve as the mount point. You can't simply mount, say, /dev/sdb to the root file system. 

 

You could, however, create a new directory, say data with the command sudo mkdir /data. You would then want to make sure whatever user or group that would need to use the directory has access using the chown command (as in sudo chown -R :writers /data) and then give the group write access with the chmod command (as in sudo chmod -R g+w /data). 

 

Once you've done that, you have a mount point that can house the external drive. You then need to find out where the drive is located, which can be done with the command lsblk. Find the drive name associated with the disk and mount it with the command sudo mount NAME /data (Where NAME is the name associated with the drive, such as /dev/sdb). 

 

At this point, everything housed in your external drive will appear in /data

 

And that, my friends, is the basics for using the mount command. To find out more details on this helpful tool, make sure to read the man page with man mount. 

 

Source

 

 

Link to comment
Share on other sites


  • Views 1.3k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...