1 00:00:06,540 --> 00:00:07,373 - In this video 2 00:00:07,373 --> 00:00:09,930 I will show you how to make mounts persistent. 3 00:00:09,930 --> 00:00:11,970 So, in order to make mounts persistent 4 00:00:11,970 --> 00:00:13,560 there's this configuration file 5 00:00:13,560 --> 00:00:16,415 and the name is /etc/fstab, 6 00:00:16,415 --> 00:00:17,700 in /etc/fstab 7 00:00:17,700 --> 00:00:19,140 You can provide 8 00:00:19,140 --> 00:00:20,580 the names of your devices 9 00:00:20,580 --> 00:00:24,390 and you can tell them where to mount. 10 00:00:24,390 --> 00:00:27,420 So I just created my sdb1 11 00:00:27,420 --> 00:00:29,610 and I want to mount my sdb1 12 00:00:29,610 --> 00:00:31,500 on the directory files 13 00:00:31,500 --> 00:00:33,000 do not create persistent mount 14 00:00:33,000 --> 00:00:36,030 on mnt because really the purpose of mnt 15 00:00:36,030 --> 00:00:38,430 is to have 16 00:00:38,430 --> 00:00:42,150 mounts that are temporary for testing. 17 00:00:42,150 --> 00:00:45,090 So the third column is where I'm specifying the file system 18 00:00:45,090 --> 00:00:47,010 ext4 in this case, 19 00:00:47,010 --> 00:00:48,570 in the fourth column, 20 00:00:48,570 --> 00:00:50,490 if you have any specific mount options 21 00:00:50,490 --> 00:00:51,630 you put them in there 22 00:00:51,630 --> 00:00:53,670 in column number five and six 23 00:00:53,670 --> 00:00:55,860 you just put zeros. 24 00:00:55,860 --> 00:00:57,390 In the past they were important. 25 00:00:57,390 --> 00:00:59,160 Nowadays, column five and six 26 00:00:59,160 --> 00:01:02,010 should just contain a zero and that's enough. 27 00:01:02,010 --> 00:01:04,650 And this will make sure that if I reboot 28 00:01:04,650 --> 00:01:05,580 the new partition 29 00:01:05,580 --> 00:01:07,590 will automatically be mounted. 30 00:01:07,590 --> 00:01:10,230 Now, if I may give you an advice 31 00:01:10,230 --> 00:01:14,670 use mount -a after editing /etc/fstab 32 00:01:14,670 --> 00:01:17,400 because mount -a is going to mount them now. 33 00:01:17,400 --> 00:01:19,590 And if anything is preventing the mount 34 00:01:19,590 --> 00:01:21,720 from happening successfully, 35 00:01:21,720 --> 00:01:22,980 you get an error message. 36 00:01:22,980 --> 00:01:26,370 As you can see, mount point does not exist. 37 00:01:26,370 --> 00:01:29,610 And at this point, it's very easy to fix the error. 38 00:01:29,610 --> 00:01:33,810 I'm just using sudo mkdir /files to create the mount point. 39 00:01:33,810 --> 00:01:37,293 And if I do my mount -a again, now it is successful. 40 00:01:39,000 --> 00:01:41,400 If you don't do the mount -a to test, 41 00:01:41,400 --> 00:01:43,500 you might get in trouble while booting 42 00:01:43,500 --> 00:01:45,150 and in a booting environment, 43 00:01:45,150 --> 00:01:48,420 if your mount is not happening in a successful way 44 00:01:48,420 --> 00:01:51,030 it's becoming a lot more complex. 45 00:01:51,030 --> 00:01:53,520 Let's finish by verifying the mount. 46 00:01:53,520 --> 00:01:56,163 If I type mount, the latest mount 47 00:01:56,163 --> 00:01:57,450 that you have just added 48 00:01:57,450 --> 00:01:59,670 is always listed on the last line, 49 00:01:59,670 --> 00:02:00,693 as you can see. 50 00:02:01,620 --> 00:02:04,780 You can also use sudo findmnt 51 00:02:04,780 --> 00:02:06,330 where findmnt as you know 52 00:02:06,330 --> 00:02:09,780 is showing you the file system structure 53 00:02:09,780 --> 00:02:11,940 with the mounts. 54 00:02:11,940 --> 00:02:13,230 So for any, 55 00:02:13,230 --> 00:02:16,200 any directory that is mounted on a different device 56 00:02:16,200 --> 00:02:17,320 findmnt will show you 57 00:02:18,210 --> 00:02:20,038 or lsblk. 58 00:02:20,038 --> 00:02:22,320 lsblk is showing it 59 00:02:22,320 --> 00:02:24,360 from the perspective of the block device. 60 00:02:24,360 --> 00:02:27,420 So here we can see that dev sdb1 has been mounted 61 00:02:27,420 --> 00:02:29,310 on slash files. 62 00:02:29,310 --> 00:02:32,970 And finally, you can also use df -h 63 00:02:32,970 --> 00:02:33,870 which is showing it 64 00:02:33,870 --> 00:02:36,120 from a disc usage perspective 65 00:02:36,120 --> 00:02:36,953 where we can see 66 00:02:36,953 --> 00:02:38,080 that sdb1 67 00:02:38,940 --> 00:02:41,010 is on a five gigabyte disc 68 00:02:41,010 --> 00:02:44,520 and it has used 28 kilobyte in total. 69 00:02:44,520 --> 00:02:45,810 That sounds reasonable. 70 00:02:45,810 --> 00:02:48,930 All of these help you to verify your mounts 71 00:02:48,930 --> 00:02:49,763 and that's it.