Knowledgebase
Setup Flexible Disk Storage with Logical Volume Management (LVM) in Linux – PART 1
Logical Volume Management (LVM) makes it easier to manage disk space. If a file system needs more space, it can be added to its logical volumes from the free spaces in its volume group and the file system can be re-sized as we wish. If a disk starts to fail, replacement disk can be registered as a physical volume with the volume group and the logical volumes extents can be migrated to the new disk without data loss. In a modern world every Server needs more space day by day for that we need to expand depending on our needs. Logical volumes can be use in RAID, SAN. A Physical Disk will be grouped to create a volume Group. Inside volume group we need to slice the space to create Logical volumes. While using logical volumes we can extend across multiple disks, logical volumes or reduce logical volumes in size with some commands without reformatting and re-partitioning the current disk. Volumes can stripes data across multiple disks this can increase the I/O stats. LVM Features
My Server Setup – Requirements
This series will be titled Preparation for the setting up LVM (Logical Volume Management) through Parts 1-6 and covers the following topics. Part 1: Setup Flexible Disk Storage with Logical Volume Management
Creating LVM Disk Storage in Linux1. We’ve used CentOS 6.5 Operating system using LVM in a Virtual Disk (VDA). Here we can see the Physical Volume (PV), Volume Group (VG), Logical Volume (LV) by using following command. Here, is the description of each parameters shown in above screenshot.
So, from here we come to know that there is not enough free space in VDA disk. 2. For Creating a New Volume Group, we need to add Additional 3 hard disks in this server. It is not Compulsory to use 3 Drives just 1 is Enough to create a new VG and LV inside that vg, I am adding more here for demonstration purpose and for more feature command explanations. Following are the disks I have added additionally.
Each and every Disks are 20 GB in Size. Default PE Size of a Volume Group is 4 MB, Volume group what we are using in this server is configured using default PE.
Here the Explanation –> 1024MB = 1GB, if so 1024MB x 5 = 5120PE = 5GB, Now Divide the 5120/4 = 1280, 4 is the Default PE Size.
3. Only vda used, Currently Centos Installed /boot, /, swap, in vda physical disk using lvm there were no space remaining in this disk. Above image shows the mount Point we are using 18GB fully used for root, so there is no free space available. 4. So let’s, create new physical volume (pv), Volume Group (vg) in the name of tecmint_add_vg and create Logical Volumes (lv) in it, Here we can create 4 Logical Volumes in the name of tecmint_documents, tecmint_manager and tecmint_public. We can extend the Volume Group of currently using VG to get more space. But here, what we are going to do is to Create new Volume Group and play around it, later we can see how to extend the file systems Volume group which is currently in use. Before using a new Disk we need to partition the disk using fdisk.
Next, follow the below steps to create new partition.
Do the above steps for other 2 disks sdb and sdc to create new partitions. Then Restart the machine to verify the partition table using fdisk command. Creating Physical Volumes5. Now, it’s time to create Physical Volumes using all 3 disks. Here, I have listed the physical disk using pvs command, only one default pvs is now listed. Then create the new physical disks using command. Once again list the disk to see the newly created Physical disks. Creating Volume Groups6. Create Volume Group in the name of tecmint_add_vg using available free PV Create using PE size 32. To Display the current volume groups, we can see there is one volume group with 1 PV using. This will create the volume group using 32MB PE size in the name of tecmint_add_vg using 3 Physical volumes we created in last steps. Next, verify the volume group by running vgs command again. Understanding vgs command output:
Was this answer helpful?
|
Powered by WHMCompleteSolution