And yes, we're going to take you out now to the command line,
as I always say, I do hope you're going to join me,
and we're going to take a look, first of all,
working with our ISO files.
So we're going to download a small ISO file and make sure we
understand mount points and how we can mount it.
We'll be able to,
then list our devices with the lsblk command and the losetup command.
We're going to see, then that we have new devices,
loop devices, that are linked through to the ISO file.
When working with our disk files,
we're going to go through and create disk files with dd,
disk files with fallocate, and again, compare and contrast those commands.
So when you're ready, we'll find the command line.
Now we are going to be using, as I said in the slide,
the wget command to go and retrieve a file from our glorious internet.
If I go through and try and run wget, we can see the command is not found.
So if I go through and then say yum provides,
I want to go through and see which package provides wget.
Some package names are the same as the program name, others are not.
And it's going to be then /usr/bin where our user binaries are located,
and then obviously, the wget command.
Now as we go through, we're searching our metadata.
We'll probably have to update this.
This is a new virtual machine, and then as I go through and take a look,
we've got the wget package.
So I can then go through and elevate my privileges,
and run the yum install, and then the package name,
which is then just wget.
I don't need to worry about the version numbering.
I can go through and hit the big Enter key.
It shows me, then that it's installing two packages.
There's a requirement for an additional package.
We can just say yes, go ahead and do this.
We download the package, allow it to do its best,
and now we'll have the wget command.
I'm going to go through and paste in our URL.
Rather than type it in,
I'm going to save myself an awful lot of work by allowing the
glorious Ctrl+C and Ctrl+V to do the work for me.
Now as I said in the slides, I'm not so interested in the ISO file,
more the size of the ISO file.
This is coming down.
It should be just 36 MB, so 35.39 MB.
And that, then gives me a very quick download.
Now having downloaded the ISO file, that is a filesystem,
but it's not yet linked to any of my block devices,
so we still just see that single disk.
But again, using elevated permissions,
I can go through and use the mount command.
So we have to mount our filesystems to what are called mount points.
They are directories in our root filesystem. I can use
uppercase V and just tab complete on here.
It's the only uppercase file that I have in my home
directory and then through to the mnt directory.
That directory, actually on this system, it doesn't appear to exist.
It normally would, but let me just go through and create it,
so sudo and mkdir /mnt.
And it's designed for temporary mounts,
so where were just mounting something quickly like this ISO file.
Now the mount point exists.
I can go through and mount it and, of course,
look inside of the mnt directory, and I can see the contents of our ISO file.
But that, of course, is not the only thing that has changed.
When I run my lsblk, we can see now that I've got a new block device, loop0.
If we want to know where that came from,
if I run sudo and losetup, okay, I need to run this with elevated privileges,
but we can see, then the file /dev/loop0 is linked through to the ISO file,
and that all happened for me in the background,
so I didn't need to become involved in it.
Now that said, where I didn't need to become involved in it,
sure enough, I didn't need to, but if we want to work with this file ourselves,
we are going to have to become involved in it.
First of all, let's go through and create ourselves some disk files.
I said we can use the dd command, so this is really our disk duplicator.
We can go and say our input file is going to be /dev/0.
And I think we can all guess what that is.
It's a virtual file that is just going to send a series
of 0s through to our output file, so our of=,
and we're going to have this, let's say,
as just disk1.
I don't really need to put any extension, but let's call it disk1.img.
We're going to go through and do a block size of,
let's say, we can set this up to be, well,
any size that we want, really.
But if we set it up, let's say, to be 1 MB,
and then we can do count=1000, so that's roughly going to be a gigabyte,
1000 1 MB blocks.
Now we can see then it doesn't take a huge amount of time,
but there's a short delay whilst we're writing that data.
Another way of doing exactly the same thing is if I
go through and do an fallocate, ‑l for the length,
and then 1 GB, and I'm going to create the file,
let's say, disk2.img.
So we can see that was absolutely instantaneous.
It's done the same thing. When I go through and do an ls ‑lh on then our disk*,
we can then go through and see that we've got the two files,
1000 MB and a gigabyte, but essentially the same size.
One took a little time to create as it wrote the data, so that was dd.
Whereas, when we didn't have to write the data,
fallocate is just creating our empty disk,
allocating the space.
Now, of course, we have our two disk files.
But if we want to make use of these disk files,
these disk files have to be linked to device files.
We don't use the images directly themselves.
We go through and use device files, and we'll see in the next clip how we set that up.