Let's try to understand mounts.
It's all about the file system hierarchy, which starts with the root directory
in which you have several subdirectories, like boot data, mnt, whichever you want.
Now, this needs to be stored somewhere, and if you go for the root
directory, well, typically it's stored on a partition or on a logical volume.
I like writing my partitions as pizza pies.
So how does that work? Well, if you want to physically access the files in the root directory, you need to address this partition.
And in Linux technical terminology, that is what we call a mount.
Now, mounts are everywhere in Linux. And if you want to use a USB
thumb drive for instance, then you can make it accessible by mounting it.
If this is your USB thumb drive and you want to be able to use it, you need to make it accessible on a directory.
As I said, mounts are everywhere on Linux. Boot, for instance, is typically mounted on its own partition as well.
And other devices can be mounted as well.
The file system hierarchy is just one file system hierarchy and you just work with
it. And in the background you access all these different devices that are behind it.
Okay, so how do we manage mounts? A couple of utilities are
involved, like lsblk, which lists blocked devices and their current mount points.
The mount command lists all current mounts, and that includes administrative mounts. And for that
reason it's sometimes a little bit hard to see what exactly is going on.
DF H presents mounted devices including available disk space.
And that's convenient. You, you don't only see what is mounted where, but you also see how much disk space is still available.
And then we have FindMNT, which will show all the mounts in a tree structure.
Now let me demonstrate how you can use mount in particular to work with a USB thumb drive.
So I have connected the USB thumb drive to this system and LSBLK is what I'm going to use to find out more about it.
So it's not always very, very clear what you see, but in the
output I can see NVMe 0, N1, 20 gigabytes. That's my hard disk.
I can also see SR0, that's my optical disk.
And this optical disk is marked as rom.
And then I can see this SDA and sda well, the size that matches the size of my USB thumb drive.
And as you can see, it has a size
of 114.6 gigabytes, which equivalent to 128 gigabytes.
And on this USB thumb drive we have the partition SCA1 that has been mounted
directory dynamically so if you want to, I can use LS L on run media
student new 02 to see all the files that are on that directory.
Now, lsbok is a convenient way to see all of these mounts. You can also use
the mount command and as I told you, the mount command is giving too much information.
That is because a lot of administrative mounts are present as well. Really, as a Linux user,
you really don't care about what the system D1 mount exactly is doing. That's operating system internal.
Now, if you want to see mounts in a way that does make sense, you need to send the output to GREP to filter it a little bit.
And let's filter it by using the very first regular expression in this course.
That's the thing between the single quotes caret indicates starting with and
this regular expression is only showing lines starting with the slash.
That's because every real device has name in dev, so that starts with a slash.
Maybe you prefer using df h.df h is showing the different directories
in your system and what exactly is mounted on that directory.
So my SDA one, that's my USB thumb drive. It's a pretty big one
mounted on run media student new 02 has a size of 115gb available and
my root volume that has a size of 12gb available in total.
And finally there is findmnt and findmnt showing a tree like structure.
But what I don't like about the tree like structure too much is that again all these administrative mounts are in there
as well and really you don't want to know about them because they don't matter too much for your daily operation.
Bottom line, use either LSBOK or DF H for a clear overview of everything that is mounted.