Hello, everyone.
In this demo, I'm going to show you how to reduce and extend logical volumes.
And also I'm going to show you how to extend group value.
Finally, I'm going to show you how to remove physical volume, group volume and logical value.
Before I'm going to create anything, I'm going to run the command LVS.
As you can see here, these are the two logical volumes that we have created them.
And also I can type the command LS block.
As you can see here we have this is the device, and here are the two logical volumes and the mount
points for these two logical volumes.
So the first example, I'm going to reduce the logical volume.
This one the LV underscore department one.
Then I'm going to extend the LV underscore department two.
So you can see here are the size of this logical value.
And also this is the size of the second logical value.
So I'm going to reduce this and extend this one.
But before I'm going to do that, I'm going to unmount the two logical volumes.
So I'm going to type U mount slash slash mapper then V one.
Dash lv underscore Department one.
I'm going to do the same thing for department two double check LZ.
Block As we can see, we don't have the mount point for these two logical volume anymore.
Right now.
What we're going to do, we're going to reduce this one.
LV Reduce.
Then I'm going to use the option L that uppercase L.
Since we're going to use the reduce, then I have to type minus and I'm going to reduce, for example,
600MB.
Then I have to use the option dash r.
This dash R is going to reduce the underlying file system together with the logical value.
Then I have to type the path of the logical value.
VG one then slash.
LV underscore Department one.
Enter.
Is going to resize right now the logical volume.
As we can see here, we don't have the one gigabyte anymore for this logical volume.
So I can double check here with the Vgs.
As you can see, we have the free size right now with the 600 right now, I'm going to use this one,
the 600 to assign it to to this logical value.
So I'm going to use right now the extent.
The extend command.
Then I'm going to use the lowercase L because I want to assign whatever left here in the volume group
to this logical value.
So I'm going to use the plus.
So we know the difference with the reduce here.
I have used the minus and with the extend, I'm going to use the plus before the number or the size.
Then I'm going to type 100.
And the percentage sign free, then space.
We don't forget the dash r in order to resize the underlying file system together with the logical value.
Then def v one and v one slash and I'm going to type this one here, underscore Department two.
And I'm going to hit Enter.
And I'm going to type LVS.
As you can see here, we have extended the logical value for the underscore department to I'm going
to type Vjz.
As you can see here, we don't have a free size left in this value group.
Now, the next example, I'm going to extend the volume group.
The Vichy one in order to use this the new size.
To extend the two logical volumes else.
Block So you can see we have a free disk.
I'm going to use this single disk to assign it to this volume group.
So as I said, I'm going to add a new disk as a storage device to the volume group.
And this is an important point.
We know about that.
So the volume group we consider the volume group is like a single storage and we can add many devices
storages in that volume group.
Then I'm going to use the command V extend, I'm going to extend this volume group.
Then I have to type the disk name or the path slash slash SD.
I hit enter.
Then as you can see here we have right now the one gigabyte.
Available to this volume group.
Now I'm going to do an x LVS.
I'm going to extend this to logical value.
So I'm going to type V extend.
Then for the first one, I'm going to use a fixed size, so I'm going to use the uppercase L plus 700
megabyte.
Then dash R.
We don't forget the dash R in order to resize the underlying file system together with the logical value,
then the name or the path of that logical value.
Department one.
Hit.
Enter.
Perfect.
I'm going to do that now for the next one.
Just extend.
And I'm going to use right now whatever lift.
Let me check here.
As you can see here, whatever left here, I would like to assign it to department.
To hear lv underscore department so lv extend.
Lowercase l then we don't forget the plus hundred and percentage sign.
Three.
Then we don't forget the AR dev vg one then slash NV underscore department too.
Sometimes this path might not work so we can use another 1// mapper slash VG one then dash lv.
Underscore department, too, but we will try here.
It's worked.
So we can go both ways because there is two baths or directories.
Baths directories can point to to the same logical value.
Clear the screen, LVS and v GS.
As we can see here, we have extended the sizes of these to logical value and we can see for the volume
group we don't have any size left here or a free size left in this value group.
The last example I'm going to delete a remove the physical value and the group value and the logical
value.
So in this case, I'm going to start removing from the bottom.
To the top.
I'm going to type this commands just to explain.
So I'm going to start to remove from the logical value first, then the volume group second, then the.
The physical volume.
The last one is going to be if we remember what we did.
Indecision, how we can create the physical volume and the group volume.
And the logical value what we did we have to start creating from.
The top to the bottom.
It's the opposite here in the removing.
So we start from the bottom to the top.
So what I'm going to do first right now, I'm going to.
First, first thing I have to go to the etsy slash fstab.
We already did the unmount.
Just to double check that.
We don't maybe do it here so we don't have any mount for this.
Two logical volumes as we can see here.
Also after we have added this disk to the volume group.
So it's also we extend it and use the one giga to this two logical volumes.
So now we don't have let me check over here.
The grid.
As we can see, we don't have the Mount Point.
Also, we can see over here we don't have the mount point for these two logical volumes.
So the first command right now, what I'm going to do, vim slash etsy slash fstab.
Then I'm going to delete these two lines.
I can delete them.
Or I can.
I cannot comment these two lines, so I don't want to use them anymore.
Perfect.
I'm going to save the file and exit.
Elves.
I'm going to right now to remove the logical value first.
Def V1.
And then lv underscore Department one.
Yes.
And the second one?
Perfect.
Yes.
Then we need to move on.
Just double check here.
As you can see, we don't have this two logical volumes anymore.
So I'm going to move on to the volume group.
I need to delete the volume group.
So what I'm going to type.
We remove?
Violin group remove then VG one.
Hit enter vg s hit Enter.
We don't have that volume group anymore.
Last step the physical value for these two devices blocks.
So I'm going to type p v remove.
Then the disk, the path of the disk here, the name SDC, then dev SD hit enter.
As you can see over here.
BVS As you can see here, we don't have physical volume anymore.
Block Can see over.
I'm going to just clear the screen.
As you can see here right now, we have two fresh and new disk.
Last thing if I would like to use also this command part Puerto prop for this to just in case to inform
that the operating system that we have made changes.
So then def SD.
Hit enter ls block perfect.
As you can see here, we don't have any logical volumes right now for these two devices and also we
don't have a mount points.
Thus concludes our session.
Thank you and see you in the next lesson.