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,959 --> 00:00:53,880 So that is how it works. 10 00:00:53,880 --> 00:00:59,360 And administrators can also create mount unit files in ETC SystemD system 11 00:00:59,360 --> 00:01:01,840 and bypass FSSTEP completely. 12 00:01:01,840 --> 00:01:06,000 As I mentioned, you can even get rid of FSSTEP completely. 13 00:01:06,000 --> 00:01:10,239 I don't want to go that far in this course, but I do want to show you 14 00:01:10,239 --> 00:01:16,000 how mount units relate to ETCFSSTEP and how you can create your own. 15 00:01:16,000 --> 00:01:19,599 Let me show you how SystemD mount units are working. 16 00:01:20,000 --> 00:01:22,199 To start with, there is ETCFSSTEP. 17 00:01:22,199 --> 00:01:25,599 ETCFSSTEP is normally taking care of the mounts. 18 00:01:25,599 --> 00:01:30,360 Right here, for instance, we can see what is taken care of slash boot. 19 00:01:30,360 --> 00:01:35,599 But behind it, there is slash run slash SystemD slash generator. 20 00:01:35,599 --> 00:01:38,800 And in this generator, we can see the boot.mount. 21 00:01:38,800 --> 00:01:41,120 And that is what really is happening. 22 00:01:41,120 --> 00:01:46,680 So when we check it out, the boot.mount, then we can see what it mounts. 23 00:01:46,680 --> 00:01:50,720 This is how it mounts a device by UUID, where it mounts it, 24 00:01:50,720 --> 00:01:53,760 and the type that it mounts it. 25 00:01:53,760 --> 00:01:56,120 Now let's do something cool. 26 00:01:56,120 --> 00:02:04,519 I'm going to copy this boot.mount into ETC SystemD system. 27 00:02:04,519 --> 00:02:14,199 Then I'm going to edit ETC SystemD system boot.mount. 28 00:02:14,240 --> 00:02:17,119 And I need an install section, right? 29 00:02:17,119 --> 00:02:19,399 So install. 30 00:02:19,399 --> 00:02:23,759 And in install, I need a wanted by. 31 00:02:23,759 --> 00:02:27,559 And wanted by, where do I want it? 32 00:02:27,559 --> 00:02:37,559 Well, I'm going to use systemctl list dependencies. 33 00:02:37,559 --> 00:02:40,479 And then I'm just going to look up boot.mount, 34 00:02:40,479 --> 00:02:43,839 because this generated boot.mount is included somewhere. 35 00:02:43,880 --> 00:02:46,080 And I'm scrolling up a little bit. 36 00:02:46,080 --> 00:02:49,720 And there I can see it's a part of localfs.target. 37 00:02:49,720 --> 00:02:51,559 So now I know enough. 38 00:02:51,559 --> 00:02:57,360 And I am going to put it into localfs.target. 39 00:02:57,360 --> 00:02:59,479 Well, there we go. 40 00:02:59,479 --> 00:03:05,520 I'm using systemctl enable boot.mount. 41 00:03:05,520 --> 00:03:08,240 And there we can see the symbolic link is created. 42 00:03:08,240 --> 00:03:13,960 And I'm going to use vim on ETC FSTEP. 43 00:03:13,960 --> 00:03:17,160 And in ETC FSTEP, I'm removing the line that is 44 00:03:17,160 --> 00:03:20,119 going to mount this file system. 45 00:03:20,119 --> 00:03:21,520 Now we should be all good. 46 00:03:21,520 --> 00:03:22,679 I'm going to reboot. 47 00:03:22,679 --> 00:03:25,399 And we will see what happens after the reboot. 48 00:03:25,399 --> 00:03:27,199 So I'm back on my system. 49 00:03:27,199 --> 00:03:31,039 And I'm going to use systemctl status on boot.mount. 50 00:03:31,039 --> 00:03:32,559 And what do we see? 51 00:03:32,559 --> 00:03:34,039 We see it is loaded. 52 00:03:34,039 --> 00:03:36,320 And it is active and mounted. 53 00:03:36,320 --> 00:03:39,919 Ignore the part about ETC FSTEP because really, 54 00:03:39,919 --> 00:03:46,039 grab boot on ETC FSTEP is not showing it as active anymore. 55 00:03:46,039 --> 00:03:48,679 As you can see, the line is commented out. 56 00:03:48,679 --> 00:03:52,759 And mount by grab boot is really showing 57 00:03:52,759 --> 00:03:57,279 that the device is successfully mounted on slash boot. 58 00:03:57,279 --> 00:03:59,440 Now this is an example how you can easily 59 00:03:59,440 --> 00:04:02,199 move a file system from ETC FSTEP 60 00:04:02,199 --> 00:04:05,119 to complete management by systemd. 61 00:04:05,119 --> 00:04:07,440 You can also create your own partitions 62 00:04:07,440 --> 00:04:11,479 and mount them using systemd mount unit files.