Jack Wallen introduces the mount command to new Linux users and explains how to use it to mount an external drive in the internal file system.
Linux is capable of doing all kinds of amazing things, some of which no other operating system on the planet can do.
It is also capable of doing some very basic tasks. One such task is to mount file systems (such as external drives) on the file system. This is a crucial function, otherwise you will not be able to expand your storage or connect external data drives.
SEE: 5 Linux Server Distributions You Should Use (TechRepublic Premium)
If you’re on a Linux distribution that includes a desktop GUI, adding external drives is pretty straightforward. But what if you are using a GUI-less server? To do this, you need to use the mount command. Mount does exactly what you think it does, it mounts an external drive into your internal file system.
But it’s not that simple. First of all, you need to have a directory in the internal file system that serves as a mount point. For example, you cannot simply mount / dev / sdb on the root filesystem.
However, you could create a new directory such as data with the command sudo mkdir / data. You then want to make sure that any user or group that needs to use the directory has access using the chown command (as in sudo chown -R: writers / data), then give the group write access using the chmod command (as in sudo chmod -R g + w / data).
SEE: Linux 101: How to Run Commands From Nano Text Editor (TechRepublic)
Once you do, you will have a mount point that can accommodate the external drive. You then need to find out where the drive is, what with the command lsblk. Find the drive name associated with the hard drive and mount it with the command sudo mount NAME / data (Where NAME is the name assigned to the drive, e.g. / dev / sdb).
At this point, everything that is on your external drive will show up in / data.
And that, my friends, are the basics of using the mount command. For more details on this helpful tool, be sure to read the man page with man mount.
Subscribe to TechRepublics How to get tech up and running on YouTube for the latest technical advice to business professionals from Jack Wallen.