1 00:00:06,750 --> 00:00:08,070 - So in this video 2 00:00:08,070 --> 00:00:10,713 we are going to actually create some partitions. 3 00:00:11,580 --> 00:00:14,100 Now what you need to know in order to create partitions 4 00:00:14,100 --> 00:00:16,200 there are two different systems. 5 00:00:16,200 --> 00:00:17,910 To start with, there is MBR. 6 00:00:17,910 --> 00:00:20,850 MBR stands for mass boot record 7 00:00:20,850 --> 00:00:25,530 and MBR is the old solution for addressing discs. 8 00:00:25,530 --> 00:00:27,960 It was introduced in 1981 together 9 00:00:27,960 --> 00:00:30,000 with the original PC standard. 10 00:00:30,000 --> 00:00:33,540 So it's very old and very minimal 11 00:00:33,540 --> 00:00:37,140 but it is still used, especially in cloud environments. 12 00:00:37,140 --> 00:00:40,290 And for that reason, you should know how to work with MBR. 13 00:00:40,290 --> 00:00:43,410 In MBR, a maximum of four partitions can be written 14 00:00:43,410 --> 00:00:47,216 to a 512 bytes boot sector on the hard desk. 15 00:00:47,216 --> 00:00:49,620 And to address beyond four partitions, 16 00:00:49,620 --> 00:00:51,660 three of them are configured as primary 17 00:00:51,660 --> 00:00:54,960 and one is configured as an extended partition. 18 00:00:54,960 --> 00:00:56,910 Extended partitions can only be used to 19 00:00:56,910 --> 00:00:58,350 include logical partitions. 20 00:00:58,350 --> 00:01:01,020 And the first logical partition is always numbered 21 00:01:01,020 --> 00:01:02,673 as partition number five. 22 00:01:03,625 --> 00:01:05,670 Fdisk is the most important utility 23 00:01:05,670 --> 00:01:08,010 to create NBR partitions. 24 00:01:08,010 --> 00:01:09,630 But before I'm going to show you 25 00:01:09,630 --> 00:01:11,430 I want you to understand why 26 00:01:11,430 --> 00:01:13,770 and when you need to do this. 27 00:01:13,770 --> 00:01:16,426 Well, you need to do this if ever you are going to 28 00:01:16,426 --> 00:01:19,380 add new, hard risk to Linux. 29 00:01:19,380 --> 00:01:21,180 Because before you can use it 30 00:01:21,180 --> 00:01:22,710 you need to create a partition 31 00:01:22,710 --> 00:01:24,630 and you need to create a file system. 32 00:01:24,630 --> 00:01:27,783 And that is what we are going to discover right now. 33 00:01:30,660 --> 00:01:31,890 All right. 34 00:01:31,890 --> 00:01:36,890 So first step in order to create a partition is to do LSBLK. 35 00:01:37,020 --> 00:01:39,060 LSBLK is an important command. 36 00:01:39,060 --> 00:01:41,760 It lists block devices. 37 00:01:41,760 --> 00:01:44,670 We have already seen it when I introduce mounting. 38 00:01:44,670 --> 00:01:49,350 Now, although, we see that there are four hard discs. 39 00:01:49,350 --> 00:01:51,360 SDA is a primary hard disc. 40 00:01:51,360 --> 00:01:54,480 And on SDA we already have a couple of partitions. 41 00:01:54,480 --> 00:01:56,520 SDB is a second hard disk. 42 00:01:56,520 --> 00:01:59,760 There's an SDC and an SDD as well. 43 00:01:59,760 --> 00:02:02,820 I am going to use fdisk on def SDB. 44 00:02:02,820 --> 00:02:05,973 So sudo fdisk on dev SDB. 45 00:02:07,080 --> 00:02:08,790 To address these hard discs. 46 00:02:08,790 --> 00:02:11,190 You need to address them as a file. 47 00:02:11,190 --> 00:02:14,160 So this SDA, SDB, SDC, et cetera 48 00:02:14,160 --> 00:02:17,250 exists as file in the dev directory. 49 00:02:17,250 --> 00:02:18,870 Dev is for devices. 50 00:02:18,870 --> 00:02:20,460 And if you want to create partitions 51 00:02:20,460 --> 00:02:23,283 pseudo fdisc on dev SDB is what you need. 52 00:02:24,450 --> 00:02:27,123 Now, here, you can see that fdisc is telling us 53 00:02:27,123 --> 00:02:28,920 that the devices does not contain a 54 00:02:28,920 --> 00:02:30,990 recognized partition table. 55 00:02:30,990 --> 00:02:33,840 That is correct because this is a brand new device. 56 00:02:33,840 --> 00:02:36,930 And that is why we can see that it created a new disk label 57 00:02:36,930 --> 00:02:40,110 with DOS disc identifier, whatever. 58 00:02:40,110 --> 00:02:40,943 And the interesting thing is 59 00:02:40,943 --> 00:02:44,340 that it is telling us it's a DOS disk label. 60 00:02:44,340 --> 00:02:45,690 And yes, that is DOS, 61 00:02:45,690 --> 00:02:48,720 as in the disc operating system that was introduced 62 00:02:48,720 --> 00:02:51,750 by Microsoft in 1981. 63 00:02:51,750 --> 00:02:54,330 Good. Let me use end to create a new partition 64 00:02:54,330 --> 00:02:56,790 and here it's asking what type of partition. 65 00:02:56,790 --> 00:02:58,110 I wanna keep it simple. 66 00:02:58,110 --> 00:03:00,420 And we just go for primary partition 67 00:03:00,420 --> 00:03:04,320 and I'm creating partition number one, and the first sector 68 00:03:04,320 --> 00:03:06,450 I'm just accepting the default. 69 00:03:06,450 --> 00:03:08,700 And I want to specify a size 70 00:03:08,700 --> 00:03:11,160 and I make this a five gigabyte partition. 71 00:03:11,160 --> 00:03:15,210 So plus five, and then an uppercase G. 72 00:03:15,210 --> 00:03:17,070 If this kindly tells us 73 00:03:17,070 --> 00:03:18,450 what it expects us to do. 74 00:03:18,450 --> 00:03:22,110 And here we can see plus sign in K M G, T, or P. 75 00:03:22,110 --> 00:03:24,840 So plus 5g is what I want to do. 76 00:03:24,840 --> 00:03:27,390 So as you can see, it created a new partition. 77 00:03:27,390 --> 00:03:30,360 one of type Linux and a size five gigabyte. 78 00:03:30,360 --> 00:03:32,430 That's exactly what I need. 79 00:03:32,430 --> 00:03:35,250 In F this gets nice to use P to verify. 80 00:03:35,250 --> 00:03:36,420 P for print. 81 00:03:36,420 --> 00:03:39,090 And we can see everything that has done so far 82 00:03:39,090 --> 00:03:41,340 on the 10 gigabyte hard disk. 83 00:03:41,340 --> 00:03:43,230 The thing that really matters, is here. 84 00:03:43,230 --> 00:03:45,930 We see the dev SDB one. 85 00:03:45,930 --> 00:03:48,690 And if you're happy with that use w to write 86 00:03:48,690 --> 00:03:51,480 and then you have your partition. 87 00:03:51,480 --> 00:03:52,830 Of course you want to verify. 88 00:03:52,830 --> 00:03:53,970 And in order to verify 89 00:03:53,970 --> 00:03:57,270 that everything worked all right, sudo, LSB, okay. 90 00:03:57,270 --> 00:03:58,710 Is the right thing. 91 00:03:58,710 --> 00:04:00,836 And now we can see that on SDB. 92 00:04:00,836 --> 00:04:04,143 We now have an SDB one device as well. 93 00:04:05,160 --> 00:04:08,790 Oh, and by the way, I have just demonstrated fdisk. 94 00:04:08,790 --> 00:04:12,120 Fdisk is an old and very powerful utility. 95 00:04:12,120 --> 00:04:14,460 You may hear about parted as well. 96 00:04:14,460 --> 00:04:16,590 Honestly, I don't like parted 97 00:04:16,590 --> 00:04:18,720 because it's not a very intuitive tool. 98 00:04:18,720 --> 00:04:20,251 Even if it has been developed 99 00:04:20,251 --> 00:04:23,280 to be more intuitive than Fdisk. 100 00:04:23,280 --> 00:04:25,320 So if I may give you strong advice 101 00:04:25,320 --> 00:04:27,300 invest some time learning fdisk. 102 00:04:27,300 --> 00:04:30,390 Because you will be better off on the long term, especially 103 00:04:30,390 --> 00:04:34,620 if later you want to continue with one of the exams 104 00:04:34,620 --> 00:04:37,170 certification exams for Linux, and you need to 105 00:04:37,170 --> 00:04:40,200 be able to do advanced stuff with partitions as well. 106 00:04:40,200 --> 00:04:42,363 Then fdisk definitely is the best.