Skip to main content
Philguy412

4 years ago

Logical extent vs MB size question.

I'm going through a practice RHCSA exam and one of the questions ask me to create a logical volume with a size of 32 logical extents. Before this I had just created a volume group 8MB in size. The answer told me 32 logical extents equates to 256MB. So my question is, how did they arrive at that answer? I know 32 times 8MB equals 256MB but whats the logic behind that?

Image of 2bearqloza
2bearqloza
4 years ago
Hey David. When you create a volume group, you can specify the size of the physical extent for that group (otherwise it will have a default value of 4MB). When you make logical volumes, it consists of logical extents, meaning, minimum size chunks, and each logical extent has to match the physical extent of the volume group. Basically, you create a volume group, and you say that your physical extent is 2MB. Whenever you create a logical volume from that volume group, the size of that logical volume has to be an increment of 2. You can specify the size (instead of number of extents), but you cant have it be 5MB. It will automatically round it up (if I recall correctly) to 6MB, because the extent is 2MB. If your physical extent is 8MB, each logical volume created from that volume group can be the size of 8,16,24,32MB etc. So when they ask you to create a logical volume of 32 logical extents, and the physical extent is 8MB, your logical volume have 32 chunks of 8MB, so 256MB.Hope this helps.
Image of Philguy412
Philguy412
4 years ago
Thanks for the explanation. I think I understand it now. I'm going to practice some more with it. Thanks again!
Image of 2bearqloza
2bearqloza
4 years ago
Its pretty easy to practice with LA`s servers. You can start couple, and do a parallel work. Thats how I did that part for RHCSA :) Glad I could help, and good luck.
Image of Philguy412
Philguy412
4 years ago
If you don't mind me asking another question, if a question asks me to format a logical volume with a file system and mount it in blah blah blah directory, do I mount the partition that the logical volume was created in? And does the mount location need to be in a specific directory or anywhere as long as i make the directory and specify the correct path?In this case, I created a logical volume in a partition named XVDF1. To do the above task I ran "mkfs -t xfs /dev/xvdf1" Did I do this correctly? I only ask because in the lab, it gives me an error that cannot open /dev/xvdf: device is busy. Either I did it wrong or there's just some limitation on the lab server that's preventing me from completing it.I appreciate any help. Thank.
Image of 2bearqloza
2bearqloza
4 years ago
Hi David. There are no limitations on LA servers regarding this. I think you just need to wrap your head around the concept (same as me when I was studying), and think about the entire LVM idea. So, when you create a partition out of a disk, lets say disk xvdf, using fdisk for example, you will get xvdf1 partition. First, please note that you have to create that partition with a LVM type. So its not a standard Linux partition, nor swap. It has to be formatted for LVM. After that, you need to create a physical volume out of that partition. Then. you use that physical volume to create a volume group, and last you create a logical volume from that volume group. In the question above (format a logical volume with a file system and mount it in blah blah blah directory), you are not mounting the partition, you are supposed to mount a file system that was created on that partition. You are always mounting file systems, whether they are created from a regular partition or from a logical volume. The mount location (dir) has to be the one they ask you to be. So you will create a dir (if it doesnt exist), and mount your file system there. Please note that you must mount it persistently (using fstab).As for mkfs -t xfs /dev/xvdf1, it doesnt look correct. This is because xvdf1 is a partition, that will be formatted as physical volume, that will be used to create a volume group, out of which you will create a logical volume. That logical volume will have a different path. Either /dev/vg-name/lv-name or /dev/mapper/vgname-lvname. So if you create a group battlestart, with a logical volume galactica (examples from LA), you would do something like this: # mkfs -t xfs /dev/battlestart/galactica or # mkfs -t xfs /dev/mapper/battlestar-galactica (I might have made a minor mistake in writting here, but the idea is there).Try to practice and differentiate between regular partition, both standard and extended, and LVM, because this is a very important part of the test, and you really want to know exactly what you are doing. As I said, I had the same issue when I started. Just listen to tutorials carefully, and look at the photos that show the general idea of LVM, to understand how they work, and also WHY they are used.If you get stuck, feel free to post here again. We all needed help more than once, and still do ;)
Image of Philguy412
Philguy412
4 years ago
Thanks for the help and clarification. The only question I still have is the mount location.In the LA labs we generally mount to the /mnt/xxxxx directory. If the question ask me to mount the file system to the /battlestar directory, is it implied that i'm mounting it with the full path of /mnt/battlestar?
Image of 2bearqloza
2bearqloza
4 years ago
No its not. You need to mount exactly where they tell you to. I can be under mount, like /mnt/battlestart, but it can also just be /battlestar.
Image of Philguy412
Philguy412
4 years ago
Alright I get it now. Thank you very much for the help. You've cleared up a lot.
Image of 2bearqloza
2bearqloza
4 years ago
No worries :) Good luck with practice.