File System Mounting (Demo)

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 Cybrarians and welcome
00:00
back to the Linux plus course.
00:00
Here at Cybrary, I'm
00:00
your instructor Rob Goelz and in today's lesson,
00:00
we're going to discuss mounting file systems.
00:00
Upon completion of today's lesson,
00:00
you are going to be able to use the commands
00:00
mount and umount to
00:00
mount and unmount file systems respectively,
00:00
and we're going to understand how
00:00
to find information about
00:00
those mounted file systems using
00:00
proc mounts and the etc mtab directories.
00:00
Now that we know how to create a file system,
00:00
but how do we go ahead and access that?
00:00
How do we write to it?
00:00
How do we see the files that are on
00:00
the file system or put
00:00
files on the file system we created?
00:00
The process for making a file system
00:00
available for use is called mounting a file system.
00:00
How do we do this? Well,
00:00
let's find out with some demo time.
00:00
Here we are over in
00:00
our CentOS machine and what we're going to do
00:00
today is work on mounting some of
00:00
these file systems that we
00:00
created in the previous lesson.
00:00
If we wanted to run
00:00
the mount command to mount something,
00:00
we can run mount and then do
00:00
a grep to see what is mounted on the system.
00:00
If we were looking to see if there are
00:00
any devices mounted,
00:00
any of our normal devices,
00:00
we could do a grep for SD.
00:00
We see that we have things mounted.
00:00
We have SDA1 and 2 and 5 mounted for
00:00
the different file systems and
00:00
directories that are already in use on this system,
00:00
but we don't see our Dev SDB and SDC1 yet.
00:00
Now without any options,
00:00
the mount command will display
00:00
all mounted file systems on
00:00
this Linux system and
00:00
you can see that's quite a bit of information.
00:00
To explicitly mount a file system,
00:00
we have to provide the file system
00:00
a place to live, called a mount point.
00:00
Since we were playing around with ext4 and xfs,
00:00
let's go ahead and create some mount points with
00:00
that name just to keep things consistent.
00:00
What we'll do is we'll create some mount points here,
00:00
and we'll create them in the directory
00:00
mount and we'll call
00:00
one ext4 and we'll call the other one xfs.
00:00
Now we can just do an ls on mount and
00:00
we should see we have ext4 and xfs.
00:00
To mount our ext file system,
00:00
which is the one that we created on Dev SDB1,
00:00
we can run mount and then specify the device,
00:00
the partition that has the file system Dev SDB1,
00:00
and the place we want to mount it in,
00:00
which is going to be ext4
00:00
and hit "Enter" and now that it's been
00:00
mounted we can do a mount command and do a grep for SD.
00:00
We will see that we also have
00:00
Dev SDB1 mounted on mount ext with type ext4.
00:00
To mount our xfs file system,
00:00
they look very similar.
00:00
We're just going to run mount,
00:00
Dev, SDC1,
00:00
which is our xfs file system
00:00
and we're going to melt that amount xfs
00:00
file system and there we are, that is done.
00:00
Now let's run the mount grep SD command again.
00:00
We can see that we have SDB1
00:00
>> and SDC1 both mounted there.
00:00
>> That's one way we can see
00:00
>> the newly mounted file system,
00:00
>> but we can also see this information
00:00
using the prof mouse directory,
00:00
so let's run cat on the proc mounts
00:00
file and we can see the output.
00:00
That looks pretty similar to what we
00:00
get when we run mount, right?
00:00
Well, that's actually what a mount does,
00:00
it just reads from the proc mounts directory
00:00
when you're on the mount command.
00:00
Now we can also look inside of the etc mtab files.
00:00
We can do a cat on etc mtab.
00:00
Let me clear the screen here so
00:00
it's a little easier to see.
00:00
When we do that, we can see that,
00:00
proc mounts and etc mtab are
00:00
identical and centralized just for reference
00:00
but those are two places where you can find
00:00
that information other than
00:00
just running the mount command,
00:00
you can cat proc mounts or etc mtab.
00:00
What if we want to remove the file systems?
00:00
Well, the first thing that we need to do is unmount
00:00
them and we're going to do that
00:00
>> using the umount command.
00:00
>> Please note that there's only one n
00:00
in the umount command,
00:00
it's umount and not unmount.
00:00
Oddly enough, you use umount for the unmount command.
00:00
I've typed unmount by accident many times,
00:00
please learn from my errors.
00:00
Umount is the command you want to
00:00
use to unmount a file system.
00:00
This is done in order we
00:00
can make sure that the file system is no
00:00
longer in use by the OS or
00:00
any users before we remove the file system.
00:00
Let's go ahead and unmount or two
00:00
file systems, how do we do that?
00:00
Well, we run umount and we just specify the mount.
00:00
We don't need to specify
00:00
everything like we did in the previous command.
00:00
We don't need to specify the device and the mount,
00:00
we just specify the mount
00:00
because that's what we're operating on.
00:00
We're removing, we're unmounting from the mount point.
00:00
When you mount on mount ext4 and that
00:00
removes it and we're also going to do
00:00
a umount on mount xfs,
00:00
and now that mount has been removed.
00:00
Notice that we're just using the mount name to unmount.
00:00
Again, we don't use the device
00:00
just a mount point itself.
00:00
But with that being said we've
00:00
come to the end of the lesson.
00:00
In this lesson we discovered
00:00
the mount and umount commands and went over how
00:00
to use them and we also looked into how to
00:00
view it from mount.
00:00
We've reached the end of the lesson today and in
00:00
this lesson we discussed the mount and umount
00:00
commands and we also discussed
00:00
how to view information about
00:00
our mounted file systems by using
00:00
proc mouse etc mtab and the mount command itself.
00:00
Thank you so much for being here and I look
00:00
forward to seeing you in our next lesson.
Up Next