In this tutorial you will learn How to LVM Partitioning on a Dedicated Server. LVM stands for Logical Volume Management, which provides us with a high-level view of disk storage, compared to the traditional method. This gives more flexibility to the system administrator to assign space to users and programs. Storage volumes are created under LVM control and can be resized and moved anywhere. LVM allows you to manage Storage Volumes in groups.
LVM is generally dependent on implementations that involve a large number of disks. But it is also suitable for small systems with one or two disks.
– For small systems: when you face the problem of low space in your home system and for example your home branch is full, you can easily get a new hard disk. Then easily add the new space to your home partition without having to reinstall the operating system.
– For large systems: for large systems, disk management can be a very time-consuming task. With the help of LVM, the system administrator can add a new disk to the system only when he needs more space and add it to the previous space.
To work with LVM, you need to familiarize yourself with the different parts of the LVM building, which we will define here.
1. Volume Group (VG) code:
VG is the highest appearance level used by LVM. A VG aggregates a set of LVs and PVs into a single management unit.
2. Physical Volume (PV) code:
PVs are usually a hard disk or something similar (for example, a Raid Device).
3. Code (LV) Logical Volume:
It is equal to partitions in non-LVM systems.
4. Code (PE) Physical Extent:
Each PV is divided into large pieces of data called PE, these pieces (extent) have a size equal to LE in LVs.
5. Code (LE) Logical extent:
Each LV is divided into large chunks of data called LEs, this size is the same for all LVs in a VG.
In the continuation of this article, we will teach you How to Install LVM in USA Dedicated Server. Be careful that most new distributions have LVM version 2 and you just need to install it. To do this, use the following command:
apt-get install lvm2
In the first step, you must initialize the partitions by running the following command. This command creates a VG descriptor on the first disk:
You can now create a VG by running the following command:
vgcreate my_volume_group /dev/hda5
To access LVs and VGs, you need to enable VGs using the following command:
vgchange -ay my_volume_group
If you want to add another PV to VG, you can do as follows:
vgextend my_volume_group /dev/hdb1
To create a LV with a capacity of 10G, you must use the following command:
lvcreate -L 10G my_volume_group --name my_logical_volume
If you want to create an LV that contains all VGs, use vgdisplay to see the total number of PEs available. Then run the lvcreate command:
vgdisplay | grep "Total PE"
Total PE 3576
In the above command there are 3576 PEs in this VG. To create an LV that includes all this space, use the following command:
lvcreate -l 3576 my_volume_group --name my_logical_volume
Note: Here, the lowercase letter l is used for the value.
In the previous section, you were completely familiar with how to partition with LVM and its terminology. Now the LV is ready and you can treat it as a normal partition. Format it by running the following command:
Then mount it and use it.
Note: if you want it to mount automatically during system startup, add it to fstab.
In this section, we are going to teach you how to develop an LV. Be careful if you add a PV to the VG, or if you have free space in the current VG, you can expand the LV.
There are two ways to develop LV. The following command increases the LV volume to 12G:
lvextend -L12G /dev/my_volume_group/my_logical_volume
And the following command adds one gigabyte to my_logical_volume:
lvextend -L+1G /dev/my_volume_group/my_logical_volume
One thing to note is that after you expand the LV, you need to expand the filesystem to match it. To do this, you can run the following commands:
e2fsck -f /dev/my_volume_group/my_logical_volume
LVM is for the Linux Kernel, which is used to manage disks. This system and mechanism can be implemented for many Linux distributions such as RedHat, CentOS, Fedora, Ubuntu, Debian, Suse, etc. In this post, you learned LVM Partitioning on a Dedicated Server.
How useful was this post?
Click on a star to rate it!
Average rating 3 / 5. Vote count: 5
No votes so far! Be the first to rate this post.
MinGW (Minimalist GNU for Windows) is a development environment for creating programs on Windows. It...
What is your opinion about this Blog?