1 00:00:07,260 --> 00:00:09,270 - So we have created a partition. 2 00:00:09,270 --> 00:00:11,910 We have created a file system under partition. 3 00:00:11,910 --> 00:00:13,623 Now we are ready to mount it. 4 00:00:14,850 --> 00:00:16,200 By mounting a partition, 5 00:00:16,200 --> 00:00:18,720 you will connect a partition to a directory 6 00:00:18,720 --> 00:00:21,210 and while writing to a directory that contains 7 00:00:21,210 --> 00:00:23,640 a mounted partition, rights are automatically 8 00:00:23,640 --> 00:00:26,220 committed to the mounted device. 9 00:00:26,220 --> 00:00:28,440 We have already seen that earlier 10 00:00:28,440 --> 00:00:30,060 in this course where you have seen how 11 00:00:30,060 --> 00:00:32,010 to mount a USB thumb drive 12 00:00:32,010 --> 00:00:33,510 and for partitions on disc, 13 00:00:33,510 --> 00:00:36,630 the procedure is not fundamentally different. 14 00:00:36,630 --> 00:00:38,400 When a connected device is unmounted 15 00:00:38,400 --> 00:00:42,600 you will, you won't see the files that are written anymore 16 00:00:42,600 --> 00:00:44,820 because they are not accessible through 17 00:00:44,820 --> 00:00:46,710 the directory anymore. 18 00:00:46,710 --> 00:00:48,720 And notice that mounting is also required 19 00:00:48,720 --> 00:00:52,800 for devices like DVD or CD-ROM. 20 00:00:52,800 --> 00:00:54,630 Now how do we manage mounts? 21 00:00:54,630 --> 00:00:56,730 Well, you use mount to mount device 22 00:00:56,730 --> 00:01:01,203 as in mount slash dev slash SDB one and slash MNT. 23 00:01:02,250 --> 00:01:05,310 Slash MNT is defined in the file system hierarchy standard 24 00:01:05,310 --> 00:01:08,190 as generic directory to connect your partitions 25 00:01:08,190 --> 00:01:09,810 for temporary mounts. 26 00:01:09,810 --> 00:01:13,440 If you want to make the mounts permanent 27 00:01:13,440 --> 00:01:16,770 then you should mount them on a different directory. 28 00:01:16,770 --> 00:01:19,720 But MNT is good enough for what I want to demonstrate here. 29 00:01:21,180 --> 00:01:22,890 Now once you are done with your mount, 30 00:01:22,890 --> 00:01:23,940 you use U mount, 31 00:01:23,940 --> 00:01:26,250 U mount will disconnect the mount device 32 00:01:26,250 --> 00:01:29,010 as in U mount slash MNT. 33 00:01:29,010 --> 00:01:32,790 If, while U mounting the message device is busy appears, 34 00:01:32,790 --> 00:01:34,500 You can use LSOF to find 35 00:01:34,500 --> 00:01:37,830 out which processes are keeping the device busy. 36 00:01:37,830 --> 00:01:39,840 And to verify current mounts, 37 00:01:39,840 --> 00:01:41,730 you can use couple of commands, 38 00:01:41,730 --> 00:01:44,970 like mount and LSBLK and DF minus H 39 00:01:44,970 --> 00:01:47,193 and find MNT, let me show you. 40 00:01:50,167 --> 00:01:53,040 So, we have already created these file systems, right? 41 00:01:53,040 --> 00:01:56,967 So I'm just going to use sudo mount dev SDB one 42 00:01:56,967 --> 00:01:58,860 and slash 43 00:01:58,860 --> 00:01:59,693 MNT. 44 00:01:59,693 --> 00:02:02,550 And that doesn't seem to be very problematic. 45 00:02:02,550 --> 00:02:03,526 So, 46 00:02:03,526 --> 00:02:05,490 let me do, 47 00:02:05,490 --> 00:02:07,980 sudo LS slash MNT. 48 00:02:07,980 --> 00:02:08,813 And what do we see? 49 00:02:08,813 --> 00:02:11,220 We see a lost and found directory. 50 00:02:11,220 --> 00:02:14,730 If you create EXT file systems, then you also 51 00:02:14,730 --> 00:02:17,340 you always get a lost and found directory, 52 00:02:17,340 --> 00:02:20,430 that is in case problems on the file systems have occurred 53 00:02:20,430 --> 00:02:23,400 and your operating system tries to fix these problems 54 00:02:23,400 --> 00:02:24,930 automatically. 55 00:02:24,930 --> 00:02:28,560 Now, let me use sudo CP ATC hosts 56 00:02:28,560 --> 00:02:32,310 to slash MNT and repeat this LS command. 57 00:02:32,310 --> 00:02:35,520 And yeah, we have the hosts, the host file, 58 00:02:35,520 --> 00:02:38,310 and now let me get into the directory 59 00:02:38,310 --> 00:02:40,920 and we even can see it without root permissions. 60 00:02:40,920 --> 00:02:45,920 And now I'm using sudo U mount on dev SDB one, 61 00:02:45,930 --> 00:02:48,990 and oh no, I'm getting target is busy. 62 00:02:48,990 --> 00:02:50,940 Why do I get a target is busy? 63 00:02:50,940 --> 00:02:53,490 Well, in case you don't know, you can use LSOF 64 00:02:53,490 --> 00:02:55,440 for list open files, 65 00:02:55,440 --> 00:02:59,160 LSOF is showing all processes 66 00:02:59,160 --> 00:03:01,590 that currently have files open 67 00:03:01,590 --> 00:03:03,237 and these are bash and LSOF 68 00:03:03,237 --> 00:03:04,590 and you know why? 69 00:03:04,590 --> 00:03:06,440 That is because I'm in the directory. 70 00:03:07,440 --> 00:03:09,690 If I'm using CD to get out of there 71 00:03:09,690 --> 00:03:11,370 and I'm using LSOF again, 72 00:03:11,370 --> 00:03:14,160 then you can see nothing is happening 73 00:03:14,160 --> 00:03:15,810 in this directory anymore. 74 00:03:15,810 --> 00:03:18,630 But if there are files open in a directory 75 00:03:18,630 --> 00:03:22,260 that you want to U mount, that is not going to be possible. 76 00:03:22,260 --> 00:03:24,120 So this is how you work with mounts. 77 00:03:24,120 --> 00:03:26,520 Now, the big question is, is this persistent? 78 00:03:26,520 --> 00:03:28,470 Does it come back after the reboot? 79 00:03:28,470 --> 00:03:30,300 I have a disappointing message for you. 80 00:03:30,300 --> 00:03:34,230 And the answer is no, but you can easily make it persistent 81 00:03:34,230 --> 00:03:36,390 by putting it in ETC FSTAB. 82 00:03:36,390 --> 00:03:38,733 I'll tell you about that in the next video.