Let's talk about the way how SystemD mounts file systems.
So ETCFSSTEP on modern Linux distributions is just an input file for SystemD.
And if you wanted to, you can even configure your system to work without ETCFSSTEP.
Based on the contents in ETCFSSTEP, mount files are generated in the directory
and the names of mount unit files reflect the names of directories on which they are mounting.
So if you want to mount on slash boot, the name is boot.mount, nothing else.
If you want to mount on slash mnt slash data, the name is mnt-data.mount.
The slash is replaced with a dash.
So that is how it works.
And administrators can also create mount unit files in ETC SystemD system and bypass FSSTEP completely.
As I mentioned, you can even get rid of FSSTEP completely.
I don't want to go that far in this course, but I do want to show you how mount units relate to ETCFSSTEP
and how you can create your own.
Let me show you how SystemD mount units are working.
To start with this, ETCFSSTEP.
ETCFSSTEP is normally taking care of the mounts.
Right here, for instance, we can see what is taken care of slash boot.
But behind it, there is slash run slash SystemD slash generator.
And in this generator, we can see the boot.mount.
And that is what really is happening.
So when we check it out, the boot.mount, then we can see what it mounts.
This is how it mounts device by UUID.
Where it mounts it and the type that it mounts it.
Now let's do something cool.
I'm going to copy this boot.mount into ETC SystemD system.
Then I'm going to edit ETC SystemD system boot.mount.
And I need an install section, right?
So install.
And in install, I need a wanted by.
And wanted by, where do I want it?
Well, I'm going to use systemctl list dependencies.
And then I'm just going to look up boot.mount,
because this generated boot.mount is included somewhere.
And I'm scrolling up a little bit.
And there I can see it's a part of localfs.target.
So now I know enough.
And I am going to put it into localfs.target.
Well, there we go.
I'm using systemctl enable boot.mount.
And there we can see the symbolic link is created.
And I'm going to use vim on ETC FSTEP.
And in ETC FSTEP, I'm removing the line
that is going to mount this file system.
Now we should be all good.
I'm going to reboot.
And we will see what happens after the reboot.
So I'm back on my system.
And I'm going to use systemctl status on boot.mount.
And what do we see?
We see it is loaded.
And it is active and mounted.
Ignore the part about ETC FSTEP, because really,
grab boot on ETC FSTEP is not showing it as active anymore.
As you can see, the line is commented out.
And mount by grab boot is really showing
that the device is successfully mounted on slash boot.
Now this is an example how you can easily
move a file system from ETC FSTEP
to complete management by systemd.
You can also create your own partitions
and mount them using systemd mount unit files.