![]() ![]() Resizing Logical Volumes and Extending Volume Groups In the next section we will explain how to resize logical volumes and add extra physical storage space when the need arises to do so. We’ll use ext4 as an example here since it allows us both to increase and reduce the size of each LV (as opposed to xfs that only allows to increase the size): # mkfs.ext4 /dev/vg00/vol_projects Before each logical volume can be used, we need to create a filesystem on top of it. In the image above we can see that the LVs were created as storage devices (refer to the LV Path line). To view information about a single LV, use lvdisplay with the VG and LV as parameters, as follows: # lvdisplay vg00/vol_projects # lvcreate -n vol_backups -l 100%FREE vg00Īs before, you can view the list of LVs and basic information with: # lvsĪnd detailed information with # lvdisplay The -n option is used to indicate a name for the LV, whereas -L sets a fixed size and -l (lowercase L) is used to indicate a percentage of the remaining space in the container VG. It is considered good practice to name each logical volume according to its intended use.įor example, let’s create two LVs named vol_projects ( 10 GB) and vol_backups (remaining space), which we can use later to store project documentation and system backups, respectively. When it comes to creating logical volumes, the distribution of space must take into consideration both current and future needs. ![]() Since vg00 is formed with two 8 GB disks, it will appear as a single 16 GB drive: List LVM Volume Groups ![]() To create a volume group named vg00 using /dev/sdb and /dev/sdc (we will save /dev/sdd for later to illustrate the possibility of adding other devices to expand storage capacity when needed): # vgcreate vg00 /dev/sdb /dev/sdcĪs it was the case with physical volumes, you can also view information about this volume group by issuing: # vgdisplay vg00 If you omit /dev/sdX as parameter, you will get information about all the PVs. You can list the newly created PVs with: # pvsĪnd get detailed information about each PV with: # pvdisplay /dev/sdX To create physical volumes on top of /dev/sdb, /dev/sdc, and /dev/sdd, do: # pvcreate /dev/sdb /dev/sdc /dev/sdd Creating Physical Volumes, Volume Groups, and Logical Volumes You can either create the PVs directly on top of the device, or partition it first.Īlthough we have chosen to go with the first method, if you decide to go with the second (as explained in Part 4 – Create Partitions and File Systems in Linux of this series) make sure to configure each partition as type 8e. In this article we will use three disks of 8 GB each ( /dev/sdb, /dev/sdc, and /dev/sdd) to create three physical volumes. Each logical volume is somewhat equivalent to a traditional partition – with the advantage that it can be resized at will as we mentioned earlier. ![]()
0 Comments
Leave a Reply. |