So we need to start by creating an LVM logical volume with the name LVDB and the size of
one gig and also create the VG and PV.
So what does that mean?
Well, it means that we start with fdisk on dev nvme0n2, like before.
And I'm creating a new partition.
Now look at this.
Do you remember in the previous lab where we created partitions on disk number two?
I'm pretty sure that that was gdisk.
Now I think what has happened here is the following.
Let's get out of fdisk and let's use lsblk where we can see that we now have, oh, nvme0n3.
That looks like the original boot disk, nvme0n1.
That looks like what was previously nvme0n2.
Talking about the reason why you always want to use UUID, well, this is why.
So I am going to use fdisk on nvme0n1 because the fact that everything has been changed
doesn't matter too much as long as I create my LVM on the right location.
So n, partition number three, first sector, and last sector, well, last sector, I'm going
to use plus 1028m.
That's because the request has a logical volume with the name lvdb and the size of one gigabyte.
The problem is that if you create a partition with the size of one gigabyte, one extent
is going to be used for metadata.
So the logical volume would not be 1024 mebibytes, but 1020 mebibytes, and that's one gigabyte.
So I make my partition slightly bigger.
I'm setting the type for partition number three to LVM, and then I'm going to write
to disk, and then I can use vgcreate.
So vgcreate, there is no question about the name of the vg, so I'm just going to use something
myself like vgdb, and I'm putting my dev nvme 0n1p3 in there.
And in case you are wondering, don't you need to create the pv before?
No, I don't, because it will automatically find that nvme 0n1p3 is not yet a pv, and
it will convert the pv for me.
So now I can use lvcreate –n lvdb –l1g in vgdb, and there we can see that it worked
out all right.
Next we need to format with XFS, so mkfs.xfs on dev vgdb lvdb, and we also need to mount
it persistently.
Let me start by using mkdir slash mount slash lvdb, and then I need to mount it.
And how am I going to mount it?
Do we need the UUID?
Well, you don't, and that is because this is an LVM logical volume.
Of course, you can if you want to, but LVM logical volumes have the uniqueness in the
volume metadata header.
So if the storage device changes, that doesn't matter, the LVM logical volume will pick it
up anyway, and the name of the LVM logical volume is not going to change.
So I'm putting it on mount lvdb, and we mount it as XFS.
And next we use what?
Well, the defaults and the zero and zero, and mount minus A should be doing all right.
Now, this is a hint.
Feel free to ignore the hint.
I would say verify if the mount was effective, and as you can see on the last line, it is
mounted, and that's what you needed to do for this lab.