1 00:00:06,870 --> 00:00:09,450 - Before I'm going to tell you how to manage partitions, 2 00:00:09,450 --> 00:00:12,300 let's talk about disk storage options. 3 00:00:12,300 --> 00:00:13,890 So to use disk storage, 4 00:00:13,890 --> 00:00:15,240 partitions should be created 5 00:00:15,240 --> 00:00:19,890 to divide a disk into one or more logical areas for storage. 6 00:00:19,890 --> 00:00:20,723 It's funny 7 00:00:20,723 --> 00:00:23,100 because technically, you don't really need a partition. 8 00:00:23,100 --> 00:00:26,550 You can create a file system directly on top of a disk, 9 00:00:26,550 --> 00:00:29,010 but that makes it unrecognizable 10 00:00:29,010 --> 00:00:31,263 and is really not recommended. 11 00:00:32,580 --> 00:00:34,110 After creating a partition, 12 00:00:34,110 --> 00:00:36,840 on that partition, you will create a filesystem, 13 00:00:36,840 --> 00:00:40,293 and this filesystem takes care of the file allocation. 14 00:00:41,280 --> 00:00:43,830 So the filesystem is a logical collection of files 15 00:00:43,830 --> 00:00:44,850 that comes with solutions 16 00:00:44,850 --> 00:00:46,773 to allocate the file blocks to disk. 17 00:00:48,210 --> 00:00:49,260 Apart from partitions, 18 00:00:49,260 --> 00:00:53,220 there are also advanced storage allocation solutions. 19 00:00:53,220 --> 00:00:56,703 And these include Logical Volume Manager, or LVM. 20 00:00:57,600 --> 00:01:00,603 And this defines flexible volumes for storage allocation. 21 00:01:01,590 --> 00:01:04,080 In Red Hat, you will find Stratis, 22 00:01:04,080 --> 00:01:07,020 which is used for thin provisioning of storage. 23 00:01:07,020 --> 00:01:11,310 And volume management filesystems like ZFS and Btrfs 24 00:01:11,310 --> 00:01:14,433 combine the storage allocation unit with a filesystem. 25 00:01:16,230 --> 00:01:19,140 Different utilities can be used to create partitions 26 00:01:19,140 --> 00:01:22,143 including fdisk, parted, and gdisk. 27 00:01:23,730 --> 00:01:25,560 Now, while working with partitions, 28 00:01:25,560 --> 00:01:27,513 you should know about block devices. 29 00:01:28,920 --> 00:01:31,410 That is because the partitions and the disks 30 00:01:31,410 --> 00:01:33,450 are addressed as block devices. 31 00:01:33,450 --> 00:01:35,730 So how do you find your block devices? 32 00:01:35,730 --> 00:01:38,220 Well, the command to use is lsblk, 33 00:01:38,220 --> 00:01:41,412 and that will show you common block devices 34 00:01:41,412 --> 00:01:44,984 with names like sda, 35 00:01:44,984 --> 00:01:47,370 where sd indicates that it's SCSI disk, 36 00:01:47,370 --> 00:01:50,310 and a indicates that it's the first disk. 37 00:01:50,310 --> 00:01:53,970 There is vda, which is for a KVM virtual disk 38 00:01:53,970 --> 00:01:58,290 or xvda, which is a virtual disk in a Xen environment, 39 00:01:58,290 --> 00:02:02,913 or nvme0n1, which is the first nvme disk. 40 00:02:04,050 --> 00:02:05,700 According to the specific driver 41 00:02:05,700 --> 00:02:07,290 of the hardware that you are using, 42 00:02:07,290 --> 00:02:09,810 you might even find different block devices. 43 00:02:09,810 --> 00:02:11,823 Use lsblk to figure out. 44 00:02:12,990 --> 00:02:14,310 So on the disk devices, 45 00:02:14,310 --> 00:02:16,950 partitions are addressed by adding a number, 46 00:02:16,950 --> 00:02:19,020 so you will get sda1. 47 00:02:19,020 --> 00:02:23,340 And sometimes, if the device name itself contains a number, 48 00:02:23,340 --> 00:02:26,010 you will have P followed by a number 49 00:02:26,010 --> 00:02:29,640 like nvme0n1p1 50 00:02:29,640 --> 00:02:31,053 for partition number one. 51 00:02:32,520 --> 00:02:34,860 Block device names are allocated while booting, 52 00:02:34,860 --> 00:02:37,620 and for that reason, they are subject to change. 53 00:02:37,620 --> 00:02:39,930 That means that it's not a very good idea 54 00:02:39,930 --> 00:02:42,270 to address block devices directly, 55 00:02:42,270 --> 00:02:46,110 but better use persistent naming attributes, 56 00:02:46,110 --> 00:02:48,810 which are labels and UUIDs. 57 00:02:48,810 --> 00:02:50,250 I'll show you those later. 58 00:02:50,250 --> 00:02:53,883 For now, I'm going to show you how to create a partition.