Alright, next task was to manage partitions. So on server 1, use virtualization software
to increase the size of your primary disk with at least 10 GB. And then, in this free
space, create a 1 GB partition, format it with EXE4, and make sure it's mounted persistently
using UUID on MNT files, and also create 1 GB swap and mount it persistently using UUID.
If you know partitioning, this should be pretty straightforward. So let's check it out. First
thing, I need to go to my virtualization, and I need to power off the virtual machine.
And even if this is something that is different for all the virtualization solutions I wanted
to show you anyway, because if you don't do it, it's not going to work. So I am going
to select my removable disk, and I make it a 30 GB disk. So here, I apply, and I'm done,
and we are going to boot it again. This is obviously not something that you should expect
on the exam, because handling virtualization is not an exam objective. So back here, logging
in as my administrative user, and opening a root shell. And then, I'm using LSBLK, and
LSBLK is shown in NVMe 0 and 1 device with a size of 30 GB. And that's good. So I'm going
to use fdisk on dev NVMe 0 and 1. And there, oh boy, this looks seriously, but it's not.
It's just telling us that the disk is bigger than expected, and that is because I just
resized it. So I'm going to use N to create a new partition anyway, which will be partition
number four. So first sector, enter, last sector, plus one G. And we need to do the
same once more, partition number five, first sector, enter, last sector, plus one G. And
then, we set the T, the partition type for partition number five to swap. Then, it's
a good idea to use P to verify what you are going to do, and we can see partition four
and partition five are now all right. So I'm using W, and just to check a quick LSBLK to
verify that these devices exist, and they do. So now, I need to create some file systems.
Don't forget, if you want to use block IDs, you do need to file system first. So mkfs.ext4
on dev nvme0n1p4, and mkswap on dev nvme0n1p5. And then, I'm going to use block ID, and in
block ID, I can see my devices. Now, I need to get these UUIDs into my etcfs step, and
this is how I'm going to do it. I'm going to pipe the output to awk, because I'm in
command mode only, and how do you get a nasty UUID into your etcfs step without making any
typos? Well, this is where awk comes in handy. So I'm going to look for n1p4, and there,
I'm going to print the second column, and verifying, and that looks good. So this is
what I'm going to put into etcfs step. Double redirect, of course, is very important, because
otherwise you crush your etcfs step, and then you are in a serious situation. Now, we also
need swap, so I'm repeating this for the n1p5, which will find the UUID for the swap device.
And then I can get into etcfs step and complete what needs to be done. So we have the UUID
lines already, and that is nice, and what are we going to do? Well, the first one is
going to be mounted on mnt files, and the file system is ext4, and we don't have any
specifics or defaults, and 0, 0, that will do. And the second one, that is the swap,
we mount it on none, and the file system is swap, and here also defaults, and 0, and 0,
and that should be doing it. Now, even if systemd was taking care of the mount to create
mnt files automatically for you, I like to be in full control, so I'm using mkdir slash
mnt slash files to ensure that it is there. And then, well, I think there's only one way
to check it out, and that is to reboot. Of course, you can use mount minus A and swap on
minus A, but in the end, it needs to survive a reboot, and that is what I really want to test,
because that is a critical moment on the exam. So it's rebooting right now,
and we'll see if it's coming back all right.
So the fact already that I get my login prompt back is good news.
LSBLK is showing that partition 4 is on mnt files, and then 3 minus m is showing that I have
two gigs of swap space, hey, two gigs of swap space. Is that all right? I am not too sure about
that, and oh, look at that. We have a two-gig LVM device. So on the swap space, something is
not all right, and what are we going to do about it? Well, I'm going to check on my history, and
did I ever use the mkswap? Yeah, I used mkswap on dev nvme 0 n1 p5, and we use it. Well, let's do a
swap on minus a and 3 minus m to verify where the problem is, and apparently nvme 0 n1 p5 is not
recognized as swap correctly. So we need to do some troubleshooting, and how are we going to do
that? Well, let me use LSBLK to start it, and there I can see nvme 0 n1 p5, and that is the swap
partition, so that should be okay. Then I'm using fdisk minus L on dev nvme 0 n1, where we can see
that the partition is flagged as Linux swap, and well, I'm going to use mkswap on dev nvme 0 n1 p5
again. Something might have gone wrong, and oh, there we can see warning, wiping all swap signature,
no label, and for the moment that is okay. I want swap on on dev nvme 0 n1 p5 to see if it is doing
all right, and now 3 minus m is showing that it is doing all right. Okay, now I do have a small
challenge, and that is that we mounted by uuid, and the new uuid ends in 29d2, and if we check
etc fstab, there we can see that the old uuid didn't end in 29d2, and hey, did you see what
was going wrong? That's what you call a typo. So yeah, now I reformatted it, and because I did,
I need to replace the uuid in etc fstab, and best way to do so is to get back to the line
where we were looking for this n1 p5. Let me use control r for the reverse isearch
to get the uuid back in etc fstab. So back to etc fstab, I'm going to wipe this line
because that line had a problem, and I am going to mount this on none, and the file system type
the swap with a p this time, defaults as the mount options in 0 and 0, and that should be doing it,
and then once more I'm going to reboot. Hey, this proves that you should always verify your work,
okay, so it looked so pretty. I was capable of rebooting correctly, but still my swap space
didn't come up, so I'm so happy that I checked it, otherwise we would have missed these points.
So loading in again, let's do minus i once more,
and 3 minus m, and there we can see 3 gigs of swap, so this time everything worked out all right.