EX200 Red Hat Certified System Administrator RHCSA – Managing LVM Logical Volumes Part 2

  • By
  • January 18, 2023
0 Comment

4. Linux Volume Management (LVM) part 4

Welcome all to this tutorial. Today we are going to be doing some prep prep work in order to create all the necessary things that we will need in order to resize. A logical volume, but not resize in a sense to grow it, but rather instead to shrink it. Now, not a common practice, but you still need to know how to do it. So let’s get to it. First up, we will do the prep work as I said. And this will include some of the things that we’ve done before. So Fdiscdevsdb and I would like to create a new partition. Primary number three is fine. The defaults here, let’s say I want it to be 5GB. Partition three of type Linux a set of size 5GB. Okay, that doesn’t matter. That works. It passed.

Next up we need to specify the type. So we will use eight e for LVM linux LVM and then I will go ahead and write the changes. Excellent. So the partition table has been altered. We need to run part probe to force the kernel to reread the partition table to reload it. Anyway, that has been done. I’m going to go ahead and clear the screen. Let’s do. Disease. Dev SDB oh, no. That’s not what I wanted. Sorry. I wanted to get a listing and there you go. We have SDB Three at the bottom. Let’s go ahead and clear the screen. Next up, we need to do PV create so in order to create our physical volume.

No big deal there. So we have created a physical volume. There. And next up, we need to extend our group to envelop it. So we will type in VG. And if you type Tab vice here, you can see that you have a good amount of options we will use. Extend in order to extend group lyra one, that group lira one will be extended with dev STB three okay, so volume group lira one successfully extended VGS let’s take a look at the groups it says down here is it layer one? Okay, so it says for layer one, it says physical volumes three and logical volumes one. You might notice that my groups tend to change a lot.

Since I do a lot of prep work for these tutorials, I tend to test things out. But it doesn’t really matter. Sometimes there is stuff there from other tutorials as well. What is important is that you see the segment that we are doing now in the moment. Next up. Now that since we are reducing the logical volume, I might as well show you how to reduce a group. So just go ahead and type in VG reduce. You specify the group name and then you just literally specify, what would you like to remove from the group? So dev SDB three there you go it says removed dev SDB from volume group Lyra one I can VGS again. And it says that I have in Lyra that I have two physical volumes. And if I do VG extend and then VGS, you see that Lyra one now has three physical volumes. If you’re not following me, you can just follow the mouse.

Now I am selecting the portions that are different after reducing and extending. Anyway, let’s go ahead and clear the screen. Next up, we are going to go ahead and do well, let me just show you a shortcut for something LVS while I’m here. There you go. You can see logical volumes listed here as well. We are looking at Raju. No, that’s just for logical volume. We haven’t actually created what we want yet. Those are some things from the previous tutorials. So go ahead and type in LV create. Because we are now creating a Logical Volume, and I would like it to be to have the size of 4GB. We shall name it New and it shall belong to the group Lyra. One extra four signature detected. They want to wipe it. Yes, everything will be wiped. Logical Volume new created.

Now that we need to partition. Now we need to format it. So mkfs ex four we have to format it with extra four because XFS does not support shrinking and extra Four does support it. Simple as that. Nothing to it, really. So just go ahead and type in Devalira one New, press Enter and there you go. It has indeed been create. It has indeed been formatted. So all is well and done there. Let’s just go ahead and do a mount to be sure that all is well and fine and dandy and functional. And I have created a folder for myself in the MNT directory. I’m sure that you know how to do this by now called New. So MNT. This is my mount. This will mount point. Okay, I don’t have the folder New. It doesn’t matter. Let’s just see what do I got there. So I have Logical Volume Demi. Now.

Let’s go use LV reduce. That’s going to be just fine. If you don’t have the same folders as me in the MNT, it’s completely irrelevant. All of these things that we’re creating in the MNT directory are just some folders that are probably temporary that we are just using for our purpose in the moment. You know how to create a folder or directory, just type in Mkdir and then specify the path. No big deal there. So we have mounted it. There were no problems there. Let’s go ahead and clear the screen. Now we will go ahead and type in Displace H.

And at the bottom it says 3. 9, the 16 megabytes used. See this one here? It says 16 megabytes. That’s the metadata that has been taken by that’s the portion of the disk that’s been taken by the system for some sort of information that it needs to place on it by default. So don’t worry about it. That’s perfectly normal. Anyway, now that’s we have done this prep work, in the next tutorial we will deal with the actual resizing in terms of reducing the size of a volume. Thank you for watching and I’ll see you in the next tutorial.

5. Linux Volume Management (LVM) part 5

Welcome to this tutorial. Today I will go ahead and show you how you can actually go ahead and resize the volume. So we will do that part today. Up till this point of time, we’ve done mainly prep work. So let’s go ahead and shrink it and see how that works. First off, I need to mount it so I’m not sure if it’s mounted already. It is it’s 3. 9gb. This is actually let’s just say that it’s four. Circle it to four. But because 16 megs don’t really matter and it doesn’t show here further than the first decimal point anyway. So it’s 4GB. And now we are going to resize it to one. So at the end it should say one here. But it’s not likely that it’s going to say one. It’s probably going to be below. It’s probably going to be slightly below one. So keep that in mind when you see below one.

That’s not going to be my mistake or something like that. That’s just the way the system works. It’s going to take a few megabytes away from it anyway. In order for us to resize this, we need to unmount it first because we cannot do this live. So you mount and let’s go ahead and find it. So MNT. Okay, it’s over reduced. There we go. It’s unmounted now. And next up, we need to do a file check on the file system in order to make sure that everything is fine. In order for us to perform that file check, we will use a certain command. But before we go ahead and do that, let’s just try resizing the file system and see if we get an error message or a warning. It’s not an error message, it will be a warning. So if we type in resize two FS I’ve mentioned this command before, but we haven’t really used it. Well, you won’t use it for XFS anyway. So resize. Two FS.

And for dev, say New and let’s say it’s 1GB. Press Enter and there you go. It says Prelease run e two Fsck f first. What does this hyphen f mean? What is generally hyphen f. As an argument? It commands well, force basically, no matter what. Go ahead and do it anyway. You can type in E two Fsck hub. And you can see the F option here says Force checking. Even if the file system is marked clean, you want to be sure that all is well and nice and fine and dandy and however you wish to call it. So let’s go ahead and type in Dev alary and New. I do believe that it is new, yes.

So go ahead and press Enter. There you go. It performs five passes in order to make sure that everything is well. So no problems there. Let’s go ahead and clear the screen as we are not going to be needing this anymore. Let’s type in LV. Reduce space l one Dene. Does anybody see anything wrong with this. So let me give you a hint. There is nothing wrong with the command itself in terms of syntax or anything of a kind. Actually, this command should work without any problems. But there is something wrong with the logic of it. Can you guess what? Well, you can press pause and dwell on it if you like, but I’m going to go ahead and tell you. This command will reduce the logical volume size and you will reduce the logical volume size with this command before you reduce the size of the file system, which is not something you want, which is really not something you want to do anyway, let’s not use it and let’s use resize. I think I have this funnel already somewhere around here. There we go. If I press Enter, resizing the file system.

Okay, so all is well, no problems there. Now let’s go ahead and resize the logical volume. I think I have it here somewhere as well. I’ve done some test runs so we don’t have to type it in. There we go. Okay, I’ve resized it twice. It went down and then I’ve brought it back up again. So I’ll just change the number here to one. And if I go ahead and press Enter, there will be a warning. So this warning, it says, reducing active logical volume to 1GB. This may destroy your data file system, et cetera. So it’s asking you, do you really, and I mean really want to reduce new? You can just type in yes. You can just type in Y for yes or N for no. Be very careful. Think about it. Don’t rush into it. This is not something you want to do on a bad day when you’re nervous or something of a kind. You want to be doing this on a happy day when something awesome happened to you and you’re like, I can do this right now. And then you do it and your day gets ruined. Just joking.

Hopefully that’s not going to happen. Okay, just type in Y, press Enter and it says, okay, size of the logical volume layer one, new, changed from 4GB to 1GB. Logical volume new, successfully resized. Let’s go ahead and mount it and have a look at it. Do you believe that? I have the mount command here somewhere as well. There we go. Now, DF space. Take a look at the last one. It’s the same one, I assure you. It’s 880 megabytes, 1000 megabytes, 1024 megabytes is 1GB and 880 megabytes is 140 megabytes, 134 megabytes short of if my math is correct. If it’s not, feel free to make a shout out in the discussions. I won’t mind. I’m happy. I’m happy if you’ve noticed it, if you’ve been paying that much attention to have noticed it, that’s fantastic. You will never be able to get it right. I mean, okay, you could give it some extra and then repeat this process again and take into consideration those 120 megabytes, but it’s probably not going to be the same.

It may be more or less something like that. Depends on a lot of things, so just don’t worry about it. It doesn’t have to be exact. The last megabyte, when you’re measuring the size of something in megabytes, as long as it’s not close to a gigabyte or anything like that, it’s nothing. It’s very small. It’s like you’re counting pennies in your pocket. There isn’t much that you would theoretically be able to do with those pennies. And same principles apply here. So you can go ahead and clear the screen. And that would conclude. And with that, I would like to conclude this tutorial. I’m sorry if I’ve been rather slow in this particular tutorial, but that it was necessary, in my opinion, just to show you that you shouldn’t rush these things and to emphasize how potentially destructive this action can be. Unless you absolutely have to do this. Don’t do it. Opt for other options. If you do everything right, you’re not going to damage anything. Think everything should be fine, but there’s always a chance factor, so keep that in mind. Anyway, I bid you all farewell and I hope to see you in the follow up tutorial.

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