1 00:00:06,600 --> 00:00:08,910 - So you can manually mount a file system 2 00:00:08,910 --> 00:00:10,960 using the mount command, as we have seen. 3 00:00:11,880 --> 00:00:14,460 But if you manually mount a file system, 4 00:00:14,460 --> 00:00:16,860 it's not persistent. 5 00:00:16,860 --> 00:00:19,140 So your reboot, it's gone. 6 00:00:19,140 --> 00:00:21,600 And that is why you want to make them persistent. 7 00:00:21,600 --> 00:00:25,170 And still, the default way to go is through /etc/fstab. 8 00:00:25,170 --> 00:00:27,420 While booting, the /etc/fstab is processed 9 00:00:27,420 --> 00:00:30,390 to persistently mount these file systems. 10 00:00:30,390 --> 00:00:32,699 But on modern Linux distributions, 11 00:00:32,699 --> 00:00:35,220 /etc/fstab is processed by systemd, 12 00:00:35,220 --> 00:00:38,673 and systemd converts the mount in a systemd mount. 13 00:00:39,660 --> 00:00:41,040 If during the boot procedure, 14 00:00:41,040 --> 00:00:43,500 a file system specified in /etc/fstab 15 00:00:43,500 --> 00:00:45,030 doesn't mount successfully, 16 00:00:45,030 --> 00:00:47,220 typically a troubleshooting prompt is shown 17 00:00:47,220 --> 00:00:51,153 where the error must be fixed manually before you can go on. 18 00:00:52,110 --> 00:00:54,663 In /etc/fstab there are different fields. 19 00:00:55,890 --> 00:00:58,710 The first field is mandatory, what to mount. 20 00:00:58,710 --> 00:01:00,690 That is where you put your device. 21 00:01:00,690 --> 00:01:01,920 Then where to mount, 22 00:01:01,920 --> 00:01:04,770 that's a direction where you are going to mount it. 23 00:01:04,770 --> 00:01:08,490 The filesystem type is going to be your EXT4, your XFS, 24 00:01:08,490 --> 00:01:12,450 or whatever file system it is that you want to use. 25 00:01:12,450 --> 00:01:14,850 These three options are the most important ones. 26 00:01:15,720 --> 00:01:19,140 Because mount options are only used in specific cases, 27 00:01:19,140 --> 00:01:21,600 you might just have defaults for default mount options, 28 00:01:21,600 --> 00:01:22,890 nothing specific. 29 00:01:22,890 --> 00:01:25,410 And the dump option and Fsck option, 30 00:01:25,410 --> 00:01:26,820 these are kind of legacy, 31 00:01:26,820 --> 00:01:30,180 just put them to zero, and that will always work. 32 00:01:30,180 --> 00:01:33,123 Now let's create some persistent mounts in /etc/fstab. 33 00:01:35,850 --> 00:01:38,673 Alright, let me edit /etc/fstab. 34 00:01:39,808 --> 00:01:40,920 And in /etc/fstab, 35 00:01:40,920 --> 00:01:43,503 I'm going to include dev/sdb1. 36 00:01:44,850 --> 00:01:49,170 And this dev/sdb1, I want to mount it on, 37 00:01:49,170 --> 00:01:50,957 let's say mydata. 38 00:01:53,160 --> 00:01:56,280 So this was the EXT4 file system, 39 00:01:56,280 --> 00:02:00,000 and I'm using defaults amount option in zero and zero, 40 00:02:00,000 --> 00:02:01,743 and then we are good. 41 00:02:03,720 --> 00:02:07,500 So I need to make sure that my data exists, 42 00:02:07,500 --> 00:02:08,700 and then I'm going to reboot, 43 00:02:08,700 --> 00:02:11,350 and we are going to check if this all works out well. 44 00:02:12,870 --> 00:02:15,030 Now if the boot procedure is taking a while, 45 00:02:15,030 --> 00:02:17,070 I suggest you press the escape key 46 00:02:17,070 --> 00:02:19,710 so that you can see what is going on. 47 00:02:19,710 --> 00:02:21,390 I can see that it is mounting boot, 48 00:02:21,390 --> 00:02:22,710 it has just mounted boot, 49 00:02:22,710 --> 00:02:25,863 and now it looks as if it is getting stuck. 50 00:02:26,880 --> 00:02:28,950 Let's see what's happening. 51 00:02:28,950 --> 00:02:29,820 Now, there we go. 52 00:02:29,820 --> 00:02:31,290 This is what's happening. 53 00:02:31,290 --> 00:02:33,330 You see what's wrong on the bottom line. 54 00:02:33,330 --> 00:02:36,123 A start job is running for /dev/sdvb1. 55 00:02:37,680 --> 00:02:42,120 Well, I can tell you, I don't have any devices sdvb1. 56 00:02:42,120 --> 00:02:43,980 So this is systemd. 57 00:02:43,980 --> 00:02:47,730 Systemd is giving a timeout on anything that is failing, 58 00:02:47,730 --> 00:02:50,580 and its default timeout is one minute and 30 seconds, 59 00:02:50,580 --> 00:02:51,840 and we just need to wait. 60 00:02:51,840 --> 00:02:54,190 There's nothing that you can do to speed it up. 61 00:02:57,180 --> 00:02:59,190 So now you can see that it has failed, 62 00:02:59,190 --> 00:03:01,260 and it is continuing, 63 00:03:01,260 --> 00:03:04,530 and, well, it is entering emergency mode. 64 00:03:04,530 --> 00:03:07,733 That is because there's an error in /etc/fstab, 65 00:03:07,733 --> 00:03:09,750 and the systemd cannot see 66 00:03:09,750 --> 00:03:12,600 if the error is in a file system, 67 00:03:12,600 --> 00:03:14,700 or if it's just a typo, or anything. 68 00:03:14,700 --> 00:03:17,133 So we need human intervention here. 69 00:03:18,690 --> 00:03:21,150 I'm entering the root password, 70 00:03:21,150 --> 00:03:24,060 and, well, after entering the root password, 71 00:03:24,060 --> 00:03:25,710 I'm in emergency mode. 72 00:03:25,710 --> 00:03:27,870 Well, we already know what's going on. 73 00:03:27,870 --> 00:03:30,900 Lsblk is listing the block devices. 74 00:03:30,900 --> 00:03:32,940 We need sdb1, 75 00:03:32,940 --> 00:03:37,200 and we have sdvb1. 76 00:03:37,200 --> 00:03:38,523 That's an easy fix. 77 00:03:39,390 --> 00:03:42,150 And in many cases where you see problems 78 00:03:42,150 --> 00:03:45,960 that relate to /etc/fstab, it's an easy fix. 79 00:03:45,960 --> 00:03:48,150 You can use control D to get out of there, 80 00:03:48,150 --> 00:03:50,040 and then the default target will be started, 81 00:03:50,040 --> 00:03:52,893 and everything should be booted all right. 82 00:04:01,033 --> 00:04:03,700 (keys clicking) 83 00:04:05,790 --> 00:04:07,350 So now we are back in the root cell, 84 00:04:07,350 --> 00:04:10,500 and I want to verify that everything worked out alright. 85 00:04:10,500 --> 00:04:13,440 Of course you can type the mount command, 86 00:04:13,440 --> 00:04:16,590 but the mount command is a little bit hard to read. 87 00:04:16,590 --> 00:04:20,670 Personally I like lsblk, list block devices, 88 00:04:20,670 --> 00:04:22,950 where we can see that sdb1 89 00:04:22,950 --> 00:04:25,890 is mounted on the partition mydata. 90 00:04:25,890 --> 00:04:29,193 This is a pretty clean overview of what is mounted where. 91 00:04:30,090 --> 00:04:32,340 Now, one advice. 92 00:04:32,340 --> 00:04:36,540 If you just modified your /etc/fstab, 93 00:04:36,540 --> 00:04:38,580 please just use mount -a. 94 00:04:38,580 --> 00:04:42,780 Mount -a is going to try to mount everything 95 00:04:42,780 --> 00:04:44,040 that is not yet mounted. 96 00:04:44,040 --> 00:04:47,580 And if you made any error, mount -a will tell you. 97 00:04:47,580 --> 00:04:50,253 Otherwise, just findmnt. 98 00:04:51,150 --> 00:04:53,220 Findmnt is showing you all the mount points 99 00:04:53,220 --> 00:04:56,490 and the devices that are associated to it. 100 00:04:56,490 --> 00:05:00,060 And findmnt --verify 101 00:05:00,060 --> 00:05:03,510 is what you can use to verify the syntax 102 00:05:03,510 --> 00:05:05,340 of your /etc/fstab. 103 00:05:05,340 --> 00:05:07,950 So use either one of these solutions 104 00:05:07,950 --> 00:05:10,170 to avoid getting into a situation 105 00:05:10,170 --> 00:05:12,020 where you need to do troubleshooting.