CompTIA Linux+ XK0-005 – Unit 06 – System Configuration Part 3

  • By
  • August 3, 2023
0 Comment

19. Demo – Editing the fstab File

We now remember the fstab or FS tab. Sorry, I had somebody say that to me, and I thought it was funny. So anyway, the file system tab file is the one that we’re going to edit with VI. And remember, it was designed so that every time we start up our system that we’ll end up with drives already mounted and ready to go. And yes, believe it or not, I’m using VI to make some of my changes here. All right, so now that I have this, the next thing we’re going to do is move to the very last character in our file here using our arrow key, get all the way to the end, and then we’ll type A. So we’re in the append, we’ll hit Enter to get to a new line, and then we’re going to make some changes here. And underneath this, we’re going to put in the device, which was SDB, and hit the tab a couple of times. And that was going to be mounted as Ken’s drive.

And it was the ext three that we were creating.And we’re going to just take the defaults that we see there and we’ll stick with the same options. As far as the options that come with the file system itself, I’m going to hit actually, I don’t need to hit Enter. I think that’s pretty much just what I wanted to do. And I’ll hit Escape so that I can get out of that edit mode. And then using my colon WQ, I’m going to write those changes and then quit. And just like that, we have an S tab. What you would normally do then yeah, I did it again, the FS tab table. What you’re going to do then is reboot your system and re log in. But that’s going to mess up my video to do that. But what you would normally do at this point is reboot when you’re ready so that you can then see that your drive is automatically we mounted with each new reboot.

20. Virtual File Systems

Now there’s another type of file system, a device if you would, that you can mount and put in availability for your Linux operating system. They like to call them loop devices which should not be confused with a loop back. Now basically all it is is a file system stored within a file. And I know you’re thinking, okay, that sounds recursive. So let’s just take an example and I think the best example is you take an image of a CDROM or a DVD drive. Those images are often ISO files. What does that mean? Kind of like a Tar was a collection of files. An ISO is just that. It is like a collection of files but it’s really an image or a complete duplication of a drive. In this case a CD or a DVD. It to us appears as a single file. But if I could look into it, I would see the actual CDROM or DVD as though it was the actual drive plugged into the platter.

Now, having said that, this allows me to create what we often call virtual drives in Windows. You had to go out of your way to buy some program to be able to do this. But the idea was that I might have multiple CDs and DVDs that I want to have running and available for my system. But I don’t have five CDROM trays. I don’t have five DVD trays and I need all of them. I’m tired of switching back and forth. So what you did is you took an image of these and you stored the image on your drive physically on your hard drive. And because it’s an ISO, you then used it as a device.

So in essence, you had multiple DVD or CDROM drives on that machine. Now there are a couple of ways to do this. There are some programs for the loop device, the lo setup to create a loop or reference to a loop file. Or you can use the mount command to create a mount point for that file. So you have a couple of options there. You could also just plant all use the mount command to put it together. So method one, use the lo setup to basically create the file that’s going to be the mount point and then mount it. Or just in the mount command with a loop type name of the loop file and the mount point however you want to do it.

It’s a nice way, as I said, to have multiple CDROMs, multiple DVDs, provided you have enough hard drive space to hold all these image files. But it puts it available for you as easily as any other device or folder. And then remember, if you have to do directory moving back and forth to the different ones, you create that. We have the ability through the push D to create these little shortcuts to make that part of navigation even easier. Or if you’re using a desktop environment environment DSYNC can be just little shortcuts right on your desktop making life really easy to get to. So I think you’re going to like playing with the virtual file systems. It adds a lot of functionality in this Linux environment.

21. Demo – Mounting a Loop Device

All right, here we are in a new desktop environment that we haven’t used yet for any of our preexisting labs. This is Debian, and I’m going to show you how to create a loop device with Debian. And we chose to give you a lot of different distributions to look at. Now this one you’ll notice has a web browser called Ice Weasel rather than Firefox. I don’t know if you see any resistance emblance here ice instead of Fire or Weasel instead of Fox, but it’s going to look a lot like Firefox. But there’s some issues between Debian and the use of that term. That right at the moment I can’t think about what those are. So they’ve named this thing Ice Weasel. So don’t think it’s some weird foreign browser. Now what I’m going to do is I’m going to go to the Debian website and I’m going to follow a path by going to this get Debian link.

And I’m going to go to small CDs here in just a second. So I wanted to download a small image file and I’m scrolling down. I’m going to take small CDs for my I 386 based machine and we’re going to save this right to the desktop. So here it is. It’s downloading. And when this thing is done downloading, what we’re going to do is we’re going to rename it and we’re going to be creating this loop device as we talked about, mounting it as a virtual disk so that you can see all of those commands of how you can create these other devices while you’re working in the Linux environment. So we’ll come right back to you. As soon as this little file is finished, it’s download and continue on. All right, so we have now finished downloading our file.

And right now we’re going to let’s close this down for just a second and go to our desktop where we have this file that we’ve downloaded and we’re going to give it a much nicer name. So I just did the right click on it. I’m going to go to rename and we’re going to call it Test ISO. And I’m going to drop that file. Let me just rename it, drop it into my home directory. And now we’re going to go ahead and go to our terminal. All right. So here I am in the terminal. And just to remind you, I’m going to do su to move into the route, really don’t need to. And it tells me as a part of my prompt that I’m in the home trainer PWD will remind you that’s where I’m located. And I’m going to make a directory here called the loop test directory. So now if I do an LS L capital F, you see that I have this directory here called loop test.

The reason for that is we’re going to mount this file that we created in the trainer home. We’re going to mount that file in to this test ISO file as a loop device. And we’re going to mount it to that loop test folder that I just created. Now, I moved in as the root, who am I? Just so you can see that. So I don’t have to type sudo to make this next command, which is normally what you would have done if you had stayed on as the Trainer account, as I am in this case. So I’m going to do the mount o. I’m going to make it a loop device and it’s the test ISO and I’m going to mount it to the loop test folder. Now let’s move to loop test. So I’m going to do a CD to loop test. I want to do the LS LF. And there you can see all the files that are in that ISO.

So in a way, without having to go out and purchase software, like you often have to do on some competing operating systems, you can create virtual drives as easy as mounting the ISO file, which is kind of nice. It makes it so that you can have, I think, as I told you before, multiple CDs and DVDs all at the same time. Now I’m going to try to use the touch command while I’m in loop test, and I’m going to try to create one called My File. And as you would expect with any CD DVD, it is not writable. So you can see that it tells you it’s a read only operating system. And I’ll back up again. So the dot dot remember, on change directory brings me back up one layer. And from here I’m going to unmount you mount the loop test.

So now it won’t be there anymore. And then we’ll do the LS, LF, the loop test directory. And there’s nothing there because it’s been unmounted. So it’s not a drive any longer. So that’s very easy to be able to switch back and forth from different image files that you might be storing on your machines, on your hard drives. A lot of folks are really getting into doing these virtual disks so that they can have, as I said, lots of CDROMs available to them at the same time without having to just keep switching CDROM tray after CDROM tray. And in today’s world, with such large hard drives, it just isn’t really going to waste a lot of your space to do that. So that was creating the loop device. And we used Debian had the Gnome desktop environment for this particular example.

22. Topic B: File System Management

All right, now in this topic, we’re going to talk about managing the file system. Now, we really didn’t talk a lot about the different file systems in the previous topic, and that’s because we really covered it in another unit. Our goal here is just to say, all right, we’ve got a file system, we’ve got a partition, we’re going to talk about volumes a bit, and we’re going to talk about other things we can deal with in managing our file system. Because there’s some really cool stuff we can do to help fine tune things like our swap, file quota management and some other stuff.

23. Quotas

All right, first of all, quotas. Now, in the old days, I say that somewhat euphemistically, because the old days was like five years ago when we really didn’t have a lot of disk space and things were very expensive for storage. We created quotas so that we didn’t have people overusing disk space, so we could get every user something to store their files on. Today we have plenty of disk space. I can go down to any store as a regular old home user and buy a terabyte drive and plug it in. And now I’ve got plenty of space. Now, that doesn’t mean that we might not still use quotas, because I don’t want my server at work being used by people as their new BitTorrent MP3 storage facility.

So I might still use them. So I’m not saying they’re gone the need for them, but we certainly are using them for different reasons. Anyway, you can create quotas based on individual users, on groups of users, or both. When you create a quota, you’re saying basically of the files they own. Remember, ownership is important. Of the files they own.This is how much space they have on this particular partition. Now, you can choose to create a soft limit or a hard limit. A hard limit says if they get 10GB of storage, then that’s it. Once they try to hit one bite over, they’re done.

They cannot save the file is like physically saying your hard drive is only ten gigs in size. A soft limit says, well, you reportedly only have ten gigs, but if you go over, you’re okay by default for seven days before I really kind of close the hammer down on top of you and say, bam, no more. Get rid of it. File is gone. So you have some choices. Now, you can enable this again through the FS tab file to make this very convenient. That means, again, when you boot this thing up, the File System tab file in the Etsy folder is going to have not only information about how drives are mounted, which devices should be there, but your quota information as well.

24. Quotas Enabled in fstab

So let’s say you open up the FS tab folder. When you open it up, what you’ll be able to do is starting to add in what we call those quota entries. Now remember, the idea behind a quota is that by user or by group, I can sit there and choose how much each person or each group of people get as far as the amount of space. Now, there’s a lot of things we can do in working with this folder, but basically what I want you to know is that enabling the quotas is nothing harder than putting entries into this file.

25. Enabling Quotas

So how do you do it? Well, to enable quotas you first must be the root user. So login as root or at least do the switch user the su to become the root. You can then install if you want to, a quota package. Now, a quota package would be software that helps you put together this quota capability. Now from there what you’ll do is you’ll create a quota user or a quota quota group or both. Now that’s important to know because we are creating users and groups that we’re assigning to these quotas. And you’ll notice the syntax is a quota user, a quota dot group which basically is defining these objects that are going to be a part of the quotas.

From there you’ll edit your FS tab file and you’ll put in the information about which quota user, which quota group they’re going to have. You’re going to put in the entries about what they’re allowed. Then you must reboot the system. Now that is important to know. Just because you put it in there doesn’t mean it automatically takes effect. Remember, the FS tab is a file that’s read at reboot, at restarting. So you reboot the sub machine. Then you can run a quota check or even the ed quota to edit or basically evaluate how it’s running.

26. Editing Quotas with edquota

All right, so one of the tools that we said you could use is this editing tool for quotas called Ed quota. Ed. Quota. Now, what that does is it makes life pretty easy for you to be able to rewrite the FS tab file and remember that this is a text file. So this particular tool actually looks like a graphical tool because it opens up VI. But remember, VI, even though it was short for visual, was still just a text editing system. So now here’s where if you haven’t paid attention to our unit on how to use VI, you’re going to be in some trouble because you need to know how to use edit mode and how to use command mode. But once you figure that out, which isn’t that hard, then it’s an easy thing for you to start working with. As far as the quotas.

27. Enabling Quotas (cont.)

Now, after you get through all of that information about the steps of going through and editing, the next thing you’ll have to do is if you choose a soft quota, edit the soft quota time limit, remember, by default is seven days. And then you can finally use a tool called rep quota to be able to confirm the quotas are running and functioning the way you expect them to be.

28. Swap Space

All right. Swap space. Swapspace is just what it was a second ago when I talked about it. It’s virtual memory. It’s a part of your hard drive that you said is going to pretend to be memory for these applications so they think they have more than you really do. Now, the reason virtual memory became so popular is because hard drive disk space is cheaper than Ram. Now, the downside side is that the hard drive is the only moving part. So virtual memory is slower than using real memory. In fact, considerably slower. We would tell you that if you are making a swap space that as a guideline, your virtual Ram amount that you create should be equal to at least the real amount of Ram that you have. Some of the older distributions used to tell you it should be double. You could probably even find some documents that say it should be 1. 5.

You’re going to have to make a decision about what works for your needs and make that particular partition for the swap file as whatever size you think is appropriate. Now, remember, when you create swap space and you put it into a specified partition, you cannot exceed the amount of storage that that partition has. You’re also going to mark it as a swap space and we’re going to talk about giving it a priority. But what about this question? What if you realize you just screwed up, you need more and you need to create more storage? Well, remember I said that your partition kind of limits the size of that swap file. And if your drive has been completely partitioned and you have no more room to make any new partitions or to expand it, you got some troubles. But without any worry, we’re going to see some tools that can help you add to your virtual Ram amount at a later time.

Comments
* The most recent comment are at the top

Interesting posts

The Growing Demand for IT Certifications in the Fintech Industry

The fintech industry is experiencing an unprecedented boom, driven by the relentless pace of technological innovation and the increasing integration of financial services with digital platforms. As the lines between finance and technology blur, the need for highly skilled professionals who can navigate both worlds is greater than ever. One of the most effective ways… Read More »

CompTIA Security+ vs. CEH: Entry-Level Cybersecurity Certifications Compared

In today’s digital world, cybersecurity is no longer just a technical concern; it’s a critical business priority. With cyber threats evolving rapidly, organizations of all sizes are seeking skilled professionals to protect their digital assets. For those looking to break into the cybersecurity field, earning a certification is a great way to validate your skills… Read More »

The Evolving Role of ITIL: What’s New in ITIL 4 Managing Professional Transition Exam?

If you’ve been in the IT service management (ITSM) world for a while, you’ve probably heard of ITIL – the framework that’s been guiding IT professionals in delivering high-quality services for decades. The Information Technology Infrastructure Library (ITIL) has evolved significantly over the years, and its latest iteration, ITIL 4, marks a substantial shift in… Read More »

SASE and Zero Trust: How New Security Architectures are Shaping Cisco’s CyberOps Certification

As cybersecurity threats become increasingly sophisticated and pervasive, traditional security models are proving inadequate for today’s complex digital environments. To address these challenges, modern security frameworks such as SASE (Secure Access Service Edge) and Zero Trust are revolutionizing how organizations protect their networks and data. Recognizing the shift towards these advanced security architectures, Cisco has… Read More »

CompTIA’s CASP+ (CAS-004) Gets Tougher: What’s New in Advanced Security Practitioner Certification?

The cybersecurity landscape is constantly evolving, and with it, the certifications that validate the expertise of security professionals must adapt to address new challenges and technologies. CompTIA’s CASP+ (CompTIA Advanced Security Practitioner) certification has long been a hallmark of advanced knowledge in cybersecurity, distinguishing those who are capable of designing, implementing, and managing enterprise-level security… Read More »

Azure DevOps Engineer Expert Certification: What’s Changed in the New AZ-400 Exam Blueprint?

The cloud landscape is evolving at a breakneck pace, and with it, the certifications that validate an IT professional’s skills. One such certification is the Microsoft Certified: DevOps Engineer Expert, which is validated through the AZ-400 exam. This exam has undergone significant changes to reflect the latest trends, tools, and methodologies in the DevOps world.… Read More »

img