1 00:00:06,930 --> 00:00:09,960 - You now know how to work with partitions and filesystems. 2 00:00:09,960 --> 00:00:12,243 Let's talk about the Logical Volume Manager. 3 00:00:13,230 --> 00:00:15,510 The purpose of the Logical Volume Manager 4 00:00:15,510 --> 00:00:18,843 or LVM is to add flexibility to the storage layer. 5 00:00:19,680 --> 00:00:23,160 An LVM has many features that don't exist on partitions. 6 00:00:23,160 --> 00:00:25,170 You can easily resize it. 7 00:00:25,170 --> 00:00:28,830 You can make snapshots for more reliable backups. 8 00:00:28,830 --> 00:00:31,860 You can do software RAID so that you can easily deal 9 00:00:31,860 --> 00:00:34,293 with a situation where one device is failing. 10 00:00:35,130 --> 00:00:37,710 You can use thin provisioning, where it looks 11 00:00:37,710 --> 00:00:40,350 as if you have a lot of storage, but really you don't, 12 00:00:40,350 --> 00:00:43,170 it's just used in a more efficient way. 13 00:00:43,170 --> 00:00:46,140 And you can use multi-device, multiple devices 14 00:00:46,140 --> 00:00:50,223 in one LVM logical volume to make it real big, for instance. 15 00:00:51,690 --> 00:00:54,450 A logical volume behaves like any block device. 16 00:00:54,450 --> 00:00:57,600 So once you have created your logical volume on top of that, 17 00:00:57,600 --> 00:00:59,673 any filesystem can be created. 18 00:01:01,500 --> 00:01:02,970 In order to work with a LVM, 19 00:01:02,970 --> 00:01:04,800 it makes sense to understand a little bit 20 00:01:04,800 --> 00:01:06,540 about the architecture. 21 00:01:06,540 --> 00:01:08,580 It's a three-layer architecture. 22 00:01:08,580 --> 00:01:12,000 It starts with the physical volume or the pv, 23 00:01:12,000 --> 00:01:14,970 which represent the block devices. 24 00:01:14,970 --> 00:01:18,153 So every block device in LVM is known as a physical volume. 25 00:01:19,020 --> 00:01:21,360 Then there is the volume group or vg, 26 00:01:21,360 --> 00:01:24,390 which represents all of the available storage. 27 00:01:24,390 --> 00:01:25,980 And the nice thing about the volume group 28 00:01:25,980 --> 00:01:28,350 is that it's really an abstraction of all the storage 29 00:01:28,350 --> 00:01:31,350 that is available and that is where you are working from 30 00:01:31,350 --> 00:01:34,620 and from which you are creating the logical volumes. 31 00:01:34,620 --> 00:01:38,430 These logical volumes are created as logical block devices 32 00:01:38,430 --> 00:01:42,360 from the volume group and formatted with any filesystem. 33 00:01:42,360 --> 00:01:44,070 And that's what you need to keep in mind. 34 00:01:44,070 --> 00:01:47,310 While working with LVM, you work on the logical volumes. 35 00:01:47,310 --> 00:01:49,660 You don't work on the physical volumes anymore. 36 00:01:51,090 --> 00:01:53,853 Let me make a drawing so that we can visualize this. 37 00:01:56,190 --> 00:01:59,970 So if you want to understand what LVM is all about, 38 00:01:59,970 --> 00:02:02,613 then we should really start from the volume group. 39 00:02:03,660 --> 00:02:05,730 Because the volume group is the abstraction 40 00:02:05,730 --> 00:02:08,190 of all the storage that you have, 41 00:02:08,190 --> 00:02:10,170 it's something that is resizable, 42 00:02:10,170 --> 00:02:15,170 and at the lower end, you can add physical volumes, the pvs. 43 00:02:17,430 --> 00:02:22,290 These pvs are your discs or your partitions 44 00:02:22,290 --> 00:02:25,143 or whatever, your block devices, basically. 45 00:02:26,100 --> 00:02:29,553 So any block device can be added as a physical volume. 46 00:02:30,499 --> 00:02:33,240 On the top end of LVM, 47 00:02:33,240 --> 00:02:36,030 you are going to extract logical volumes 48 00:02:36,030 --> 00:02:37,413 from the volume group. 49 00:02:38,490 --> 00:02:41,100 And these logical volumes also behave 50 00:02:41,100 --> 00:02:43,140 like the block devices. 51 00:02:43,140 --> 00:02:47,700 So on the logical volume, you are going to use your mkfs, 52 00:02:47,700 --> 00:02:50,220 and that is what you are going to mount. 53 00:02:50,220 --> 00:02:52,560 And that is how LVM is organized. 54 00:02:52,560 --> 00:02:54,060 Now the nice thing about it 55 00:02:54,060 --> 00:02:56,790 is that if you run out of a disk space 56 00:02:56,790 --> 00:03:01,260 in a filesystem, then you can easily add more disk space 57 00:03:01,260 --> 00:03:03,130 from the volume group 58 00:03:03,990 --> 00:03:05,130 if the volume group 59 00:03:05,130 --> 00:03:07,650 does have additional disc space available, 60 00:03:07,650 --> 00:03:10,350 and if it doesn't have any disk space available, 61 00:03:10,350 --> 00:03:11,490 well, you can extend it 62 00:03:11,490 --> 00:03:15,360 by just adding another pv to the volume group. 63 00:03:15,360 --> 00:03:18,693 And that's the dynamic of LVM and that's why people like it.