1
00:00:00,000 --> 00:00:11,200
Let's talk about the way how SystemD mounts file systems.

2
00:00:11,200 --> 00:00:17,000
So ETCFSSTEP on modern Linux distributions is just an input file for SystemD.

3
00:00:17,000 --> 00:00:22,760
And if you wanted to, you can even configure your system to work without ETCFSSTEP.

4
00:00:22,760 --> 00:00:27,280
Based on the contents in ETCFSSTEP, mount files are generated in the directory

5
00:00:27,280 --> 00:00:36,320
and the names of mount unit files reflect the names of directories on which they are mounting.

6
00:00:36,320 --> 00:00:41,720
So if you want to mount on slash boot, the name is boot.mount, nothing else.

7
00:00:41,720 --> 00:00:49,000
If you want to mount on slash mnt slash data, the name is mnt-data.mount.

8
00:00:49,000 --> 00:00:51,919
The slash is replaced with a dash.

9
00:00:51,919 --> 00:00:53,840
So that is how it works.

10
00:00:53,840 --> 00:01:01,759
And administrators can also create mount unit files in ETC SystemD system and bypass FSSTEP completely.

11
00:01:01,759 --> 00:01:05,959
As I mentioned, you can even get rid of FSSTEP completely.

12
00:01:05,959 --> 00:01:13,559
I don't want to go that far in this course, but I do want to show you how mount units relate to ETCFSSTEP

13
00:01:13,559 --> 00:01:15,959
and how you can create your own.

14
00:01:15,959 --> 00:01:19,559
Let me show you how SystemD mount units are working.

15
00:01:19,959 --> 00:01:22,199
To start with this, ETCFSSTEP.

16
00:01:22,199 --> 00:01:25,599
ETCFSSTEP is normally taking care of the mounts.

17
00:01:25,599 --> 00:01:30,360
Right here, for instance, we can see what is taken care of slash boot.

18
00:01:30,360 --> 00:01:35,599
But behind it, there is slash run slash SystemD slash generator.

19
00:01:35,599 --> 00:01:38,800
And in this generator, we can see the boot.mount.

20
00:01:38,800 --> 00:01:41,120
And that is what really is happening.

21
00:01:41,120 --> 00:01:46,680
So when we check it out, the boot.mount, then we can see what it mounts.

22
00:01:46,680 --> 00:01:49,440
This is how it mounts device by UUID.

23
00:01:49,440 --> 00:01:52,440
Where it mounts it and the type that it mounts it.

24
00:01:52,440 --> 00:01:55,440
Now let's do something cool.

25
00:01:55,440 --> 00:02:02,440
I'm going to copy this boot.mount into ETC SystemD system.

26
00:02:02,440 --> 00:02:13,919
Then I'm going to edit ETC SystemD system boot.mount.

27
00:02:13,919 --> 00:02:16,919
And I need an install section, right?

28
00:02:16,919 --> 00:02:19,399
So install.

29
00:02:19,399 --> 00:02:23,759
And in install, I need a wanted by.

30
00:02:23,759 --> 00:02:27,559
And wanted by, where do I want it?

31
00:02:27,559 --> 00:02:37,559
Well, I'm going to use systemctl list dependencies.

32
00:02:37,559 --> 00:02:40,479
And then I'm just going to look up boot.mount,

33
00:02:40,479 --> 00:02:43,800
because this generated boot.mount is included somewhere.

34
00:02:43,800 --> 00:02:46,039
And I'm scrolling up a little bit.

35
00:02:46,039 --> 00:02:49,720
And there I can see it's a part of localfs.target.

36
00:02:49,720 --> 00:02:51,559
So now I know enough.

37
00:02:51,559 --> 00:02:57,320
And I am going to put it into localfs.target.

38
00:02:57,320 --> 00:02:59,479
Well, there we go.

39
00:02:59,479 --> 00:03:05,520
I'm using systemctl enable boot.mount.

40
00:03:05,520 --> 00:03:08,240
And there we can see the symbolic link is created.

41
00:03:08,240 --> 00:03:13,960
And I'm going to use vim on ETC FSTEP.

42
00:03:13,960 --> 00:03:16,880
And in ETC FSTEP, I'm removing the line

43
00:03:16,880 --> 00:03:20,160
that is going to mount this file system.

44
00:03:20,160 --> 00:03:21,559
Now we should be all good.

45
00:03:21,559 --> 00:03:22,679
I'm going to reboot.

46
00:03:22,679 --> 00:03:25,440
And we will see what happens after the reboot.

47
00:03:25,440 --> 00:03:27,199
So I'm back on my system.

48
00:03:27,199 --> 00:03:31,080
And I'm going to use systemctl status on boot.mount.

49
00:03:31,080 --> 00:03:32,559
And what do we see?

50
00:03:32,559 --> 00:03:34,080
We see it is loaded.

51
00:03:34,080 --> 00:03:36,360
And it is active and mounted.

52
00:03:36,360 --> 00:03:39,960
Ignore the part about ETC FSTEP, because really,

53
00:03:39,960 --> 00:03:45,960
grab boot on ETC FSTEP is not showing it as active anymore.

54
00:03:45,960 --> 00:03:48,559
As you can see, the line is commented out.

55
00:03:48,559 --> 00:03:52,759
And mount by grab boot is really showing

56
00:03:52,759 --> 00:03:57,199
that the device is successfully mounted on slash boot.

57
00:03:57,199 --> 00:03:59,440
Now this is an example how you can easily

58
00:03:59,440 --> 00:04:02,199
move a file system from ETC FSTEP

59
00:04:02,199 --> 00:04:05,080
to complete management by systemd.

60
00:04:05,080 --> 00:04:07,360
You can also create your own partitions

61
00:04:07,360 --> 00:04:11,479
and mount them using systemd mount unit files.

