Device Mapper and LVM

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hello there Cybrarians.
00:00
Welcome back to the Linux plus course here at Cybrary.
00:00
I'm your instructor Rob Goelz.
00:00
In today's lesson we're going to be talking
00:00
about device mapper and LVM.
00:00
Upon completing this lesson,
00:00
you are going to be able to explain
00:00
the purpose of device mapper.
00:00
We're going to understand how logical
00:00
devices are constructed using
00:00
LVM commands and we'll see how
00:00
LVM and device mapper work with each other.
00:00
So far we just see regular devices.
00:00
These are automatically assigned predictable names.
00:00
The first disc on your system is dev/sda,
00:00
the second disk is dev/sdb,
00:00
and if you guessed that the third disc
00:00
is dev/sdc, you are correct.
00:00
However, Linux has another type
00:00
of device called a logical volume,
00:00
and these don't have predictable,
00:00
easy to understand,
00:00
>> automatically assigned device names.
00:00
>> Logical volumes use something called the device mapper.
00:00
Now the Logical Volume Manager, the LVM,
00:00
allows you to bring together
00:00
one or more physical devices into a single container.
00:00
You combine together devices
00:00
to make a larger amount of storage.
00:00
We're aggregating storage across many devices.
00:00
These could be a tire drives,
00:00
single partitions on the device
00:00
where you can create a rate partition as well.
00:00
What we can do as I said,
00:00
is we can aggregate devices into
00:00
a physical volume with the pvcreate command.
00:00
If you wanted to combine two devices
00:00
together into one physical volume,
00:00
we can do pvcreate device1,
00:00
device2, and we would create a physical volume.
00:00
Then we can take that physical volume and turn it
00:00
into a volume group with a vgcreate command.
00:00
We go with vgcreate,
00:00
we give it a good name,
00:00
and then we use those same two devices
00:00
we use for the physical volume.
00:00
Finally, we can create a logical volume with the LV
00:00
create command and you specify n for name,
00:00
L for size, and then give it
00:00
the vg name of the vg you've created in step two.
00:00
Let's see this.
00:00
>> We can actually create a logical volume.
00:00
>> These are the steps that you would use.
00:00
For instance, if you wanted to create
00:00
a logical volume using dev/sdb and
00:00
dev/sdc you do so by doing
00:00
pvcreate, dev/sdb and dev/sdc.
00:00
From there you can create a volume group off of that
00:00
with vgcreate vg1, dev/sdb and dev/sdc.
00:00
We use the same two devices that
00:00
we used in the pvcreate step.
00:00
Then finally, we can create that logical volume.
00:00
We're going to say lvcreate,
00:00
we'll give it a name with a dash n option.
00:00
We'll call it lv1.
00:00
We're giving it a size with the capital L dash,
00:00
capital L option of one gig.
00:00
Then finally, we'll specify
00:00
the name of the volume group,
00:00
vg1 that we want to create the logical volume of.
00:00
What is the end result of this?
00:00
The result is we get a device that can be found at
00:00
dev/vg/lv1 that is a logical volume
00:00
with one gig of space on two physical devices.
00:00
The devices dev/sdb and dev/sdc.
00:00
What does device mapper
00:00
have to do with this? Where does this can play?
00:00
Device mapper takes over at this point.
00:00
Why? Well, because dev/vg1 isn't really a device,
00:00
that vg/lv1 isn't really a device.
00:00
The vg/lv1 is a symbolic link to dev/mapper/ vg1_lv.
00:00
That's handled by device mapper.
00:00
We will get to see this in action in the next lesson.
00:00
With that, we've reached the end of the lesson.
00:00
In this lesson we covered the concept,
00:00
the high level overview of device mapper in Linux.
00:00
We got to see how logical volumes are created in LVM
00:00
>> and we talked about how device mapper and
00:00
>> LVM interact with one another.
00:00
Thank you so much for being here and I look
00:00
forward to seeing you in our next lesson.
Up Next