- In this video
I will show you how to make mounts persistent.
So, in order to make mounts persistent
there's this configuration file
and the name is /etc/fstab,
in /etc/fstab
You can provide
the names of your devices
and you can tell them where to mount.
So I just created my sdb1
and I want to mount my sdb1
on the directory files
do not create persistent mount
on mnt because really the purpose of mnt
is to have
mounts that are temporary for testing.
So the third column is where I'm specifying the file system
ext4 in this case,
in the fourth column,
if you have any specific mount options
you put them in there
in column number five and six
you just put zeros.
In the past they were important.
Nowadays, column five and six
should just contain a zero and that's enough.
And this will make sure that if I reboot
the new partition
will automatically be mounted.
Now, if I may give you an advice
use mount -a after editing /etc/fstab
because mount -a is going to mount them now.
And if anything is preventing the mount
from happening successfully,
you get an error message.
As you can see, mount point does not exist.
And at this point, it's very easy to fix the error.
I'm just using sudo mkdir /files to create the mount point.
And if I do my mount -a again, now it is successful.
If you don't do the mount -a to test,
you might get in trouble while booting
and in a booting environment,
if your mount is not happening in a successful way
it's becoming a lot more complex.
Let's finish by verifying the mount.
If I type mount, the latest mount
that you have just added
is always listed on the last line,
as you can see.
You can also use sudo findmnt
where findmnt as you know
is showing you the file system structure
with the mounts.
So for any,
any directory that is mounted on a different device
findmnt will show you
or lsblk.
lsblk is showing it
from the perspective of the block device.
So here we can see that dev sdb1 has been mounted
on slash files.
And finally, you can also use df -h
which is showing it
from a disc usage perspective
where we can see
that sdb1
is on a five gigabyte disc
and it has used 28 kilobyte in total.
That sounds reasonable.
All of these help you to verify your mounts
and that's it.