CompTIA Linux+ XK0-005 Topic: Unit 03 – File and Directory Management Part 2
December 20, 2022

31. Mount Options

Okay, so far, we’ve looked at the mount command and dealt with the type. We dealt with the device file that describes the device that you’re working with, the hardware, the mount point, and the argument that should be in the MNT mount or the media or anywhere else you want to put it. The next few are some other options. Now these options are just that: options we can add in, like do we want to make it read-only or read-write accessible? Read-write means you can delete things and change things. You can only read the data on the drive if it is set to read-only.

Adding the user or list of users that have access to that drive, whether or not the drive can have any binary files executed on it or from it, It’s either the executive or no executive. If we want to use this particular drive, we can use the auto option to have the operating system discover it automatically. So once I mount it, I’m hoping that, with the auto option, every time I bring this drive in like a USB drive, it sees it and brings it up for me automatically. Those are the rest of the options you had for the total mount command. Really, the command isn’t that hard. Maybe the hardest part of these commands is knowing the type of file system that’s being used. Honestly, that might be the hardest part of trying to figure out this command. However, if you type it incorrectly and it is the incorrect type, it will say, “Oh, this type isn’t supported,” and may even tell you which type you should be using. 

32. Example Commands

Alright, so let’s take a look at some example commands. Let’s imagine you’ve got an MS-DOS-formatted floppy drive. I’m going to ask you, where did you get it? What dumpster did you find it in? Anyway, the command would be “mount T for type VFAT comma MS Dos.” That means either the virtual Fat or the Sods must locate it in VR. It’d be the devfdirectory, which we’d mount into the mntfloppy directory. We’re going to use those options. Read-only users are allowed; no executable programmers can be run off that floppy. That means we don’t want anybody launching a virus from that floppy. If it’s a CDROM or DVD, the mount file type would be UDF or ISO, 96, 60, or both, separated by a comma. It will be mounted on the media drive.

Okay? If you want Remember, you can change those amounts anywhere else. For the options, read “only” and “users.” Okay, well, most CDs or DVDs are just that—read-only. Unless you have a read-write drive, a USB drive, or an external USB hard drive, Again, mount T. The type of system could be USBFS, virtual FAT, or whatever it is. You have to tell me the type of device. So it’s in development, and then there’ll be something like USB for devices. USB devices one and two Oh, that’s an older one, right? So that’s where you have to know what devices you have in your device folder, and we pick the appropriate device, and you tell me where you want to mount it. In this case, use the example of the MNTUSB read/write capability.

It was an internal drive. internal hard drive. Mount T. Again, the type of file system Maybe it’s a Windows one; it could be NTFS, or it could be another Linux-formatted ext 3. The device files for those are generally called HDA ones. And then you’re going to mount it as some sort of hard drive, probably an HD one. So there you go. There are a lot of different commands or methods for doing the mount command manually. if that’s what you want to do. You need to know the type. If you’re not sure of exactly the type, you can put in some options. You have to have a device file that represents the device. Tell me where to mount it and add the options.

33. Mounting

Now, there are some files that you might like to use. One in the Slash, etc. directory, specifically. Remember how you used to save your common computer configuration files in a folder called FS tab, System tab? Now, this file has two purposes. It can list all the volumes that should be mounted if those volumes are present at boot time, and it can also list default configuration options for volumes that you might mount during the use of the operating system.

In other words, instead of manually typing in the mount command, this FS tab can be designed to say, “When I boot up, this USB drive is here, or the CDROM is here, so mount it.” Or if I add a USB drive, it can say, “Oh, I’ve got a configuration for that,” and then “boom,” put it in. If you want to unmount a device, it’s easy enough to type. You can mount and then put it in the device file, or you can mount and then put the mounting point of where you mounted the device, which simply unmounts the drive. 

34. Privilege Escalation

Now, some of these commands you have to be able to do with root permissions or with something other than your regular user account. There are two ways to do what we call “privilege escalation.” One is to switch your username or the type of user you’re using. So if you’re logged in as Ken and Ken is an ordinary-level user that doesn’t have permission like root, I can type “switch user” and then put in the root account and my root password and switch to that user.

Now, maybe I don’t want to permanently switch to the root user, but I want to do this command as that user. Then we can use the sudo command, which stands for us switch user do. So if you were to break it down, it’d be the su do command. And then you put in your username, root, your password, and the command that you want to run, which might be the mount command or the unmount command.

35. Demo – Mounting and Unmounting a CD and USB Drive

All right. So we have added a couple of drives to this particular version of our operating system, Linux. In our virtual machine, we’ve installed a USB drive and a CD-ROM. So one of the things you’ll see as very common today is that when you put in new drives, they usually mount quite automatically, so you don’t have to do a whole lot of work. You don’t have to actually run the mount commands unless it’s something that they absolutely don’t see or recognize. Now I’m going to right-click this CD-ROM, and I’m going to say “Browse folder.” And by browsing it, you’re going to see that it’s just a simple installation file with a bunch of stuff I don’t want to run. It was made for windows. Likewise, I can right-click and open up this crucial drive, and you can just see a couple of folders or files that are in there. and it’s pretty straightforward.

Now in your command line up here, you may choose to look at your contents with the LS command. And so I’m going to type in LS Mediacom, and there it says there is no such file directory. So what happens is that I’m going to come over here again and look at this window. In fact, let’s just see if I can take a look at the properties. And so we know the name of the volume. It says SB installation. Let me return to this thing and open it with the browse folder, and it says SB underscore install. So let’s just do an inventory and see what we find there. And as you can see, that was the name of this particular CD-ROM. So when I typed in CDROM, it didn’t look for it; it was actually looking for the name of the file. So now I’ll try capitalizing Lsmediasb to match the case, and you’ll be able to see all of the files.

So one of the things you have to remember is that you might think, “Well, let’s do USB HDA.” You’re going to want to make sure that you actually know the name of that automatic naming convention that was given to this when you are working with the drives that have been mounted. Now of course, I could eject this particular drive. If I right-click this and choose “Eject,” that’s going to cause it to spit out of the CD-ROM tray, which it most certainly did. But unfortunately, my PC was a little smarter than me, and it actually shoved it back in. But anyway, it’s gone now, and if I repeat that command, LS, at least until that point where it recognises it again, if I were to get a chance to look at it, it would be up there, I would see that it came back, and it would have told me that it was gone.

So I guess I’m going to be a little faster this time. I’m going to eject it. I’m actually going to have to physically reach over here and grab this thing when it comes out. Now that I have it out, I am going to show that it’s missing here again. And I did the up arrow while I was fighting with that little thing. So you can see that all that’s left is the crucial drive, which is the USB.

All right? So it’s very straightforward. I wish I could have given you something more exciting to tell you how to do all this really cool stuff. On the crucial drive, I can actually right-click and unmount it. There we go. That USB drive is gone. So it’s an automatic method of being able to bring a hose in by today’s standards without having to actually go through the mount and unmount commands. You can do most of this graphically, and, as I said, auto-detect. So that makes life pretty easy when it comes to using other types of media.

36. Unit 03 Review

All right, so in this section we looked at file systems, directories, and mounting drives. We’re really making good progress in getting used to working with Linux and helping you understand all the really cool things you can do. Both automatically and manually, based on how the specific distribution was set up and created for you. So we talked about the directory hierarchy, how it’s created, edited, and deleted, how you move around the absolute paths, the use of the CD commands, and the options that you have with the relative paths. We talked about creating, editing, copying, and deleting files and being able to do that manually as opposed to working with an application if you need to.

This is especially useful for smaller devices that run an embedded version of Linux or a Linux-like operating system. And of course, the mounting of USB and optical disks, or, heaven forbid, even those floppy discs of the old type of software that you can find in the history museums these days. Anyway, you’ve got it all down. You understand how everything is pretty much a file. We know the commands we can use to see what kind of file types they are, whether it’s data or a programme or whatever it is.

And I think it’s moving you forward and getting you, I hope, very comfortable with Linux as an operating system. It suddenly shouldn’t seem so mysterious anymore, especially since you’re working with the shell and using command lines. It should start to feel pretty sensible and logical. At least that’s my hope. If not, we’re going to continue to move forward. You’re going to continue to do things and increase your skills, but I hope that you’re not afraid of the command line now and that you’re feeling pretty good about what Linux does.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!