How To Configure LVM on Linux / CentOS / Redhat
Here in this we will learn to Setup Logical Volume Management LVM on Linux. This provides a method of allocating space on mass-storage devices that is more flexible than conventional partitioning schemes. In particular, a volume manager can concatenate, stripe together or otherwise combine partitions into larger virtual ones that administrators can re-size or move, potentially without interrupting system use.
Page 1 of 7
In this lesson we have taken 4 hdd each of 20 GB (sdc,sdd,sde,sdf), These all are device drivers equivalent to physical hdd’s . The following terms will be used in the lesson
Volume Group Layout:
Free Space 5GB
You have one or more physical volumes (/dev/sdc1 – /dev/sdf1 in our example), and on these physical volumes you create one or more volume groups (smbserver), and in each volume group you can create one or more logical volumes. If you use multiple physical volumes, each logical volume can be bigger than one of the underlying physical volumes (but of course the sum of the logical volumes cannot exceed the total space offered by the physical volumes).
It is a good practice to not allocate the full space to logical volumes, but leave some space unused. That way you can enlarge one or more logical volumes later on if you feel the need for it.
In this example we will create a volume group called fileserver, and we will also create the logical volumes /dev/smbserver/data, /dev/smbserver/backup, and /dev/smbserver/videos.
1 Smbserver 80G – Name of the volume group
2 data 45G – Name of first logical volume
3 backup 10G – Name of second logical volume
4 videos 20G – Name of third logical volume
5 /dev/sdc1,/dev/sdd1,/dev/sde1,/dev/sdf1– Physical volume (PV’s) of the above 4 hdd’s. These all are device drivers equivalent to partitions on hdd’s.
6 – Press enter
Physical Volume Creation:
Use the command to list hdd available on the system. In this /dev/sda and /dev/sdb are used by Linux itself, other four will be used for LVM.
[root@SRV01 ~]# fdisk –l
You will get the following similar output.
In the above we don’t have any partitions. We haven’t made it. We need create the partition and we have to assign the LVM id (8e) to partition.Next create the partition for /dev/sdc. Here I used full hdd space as partition so simply I pressed enter without giving any value in first cylinder and last cylinder below.
If you want custom size put the value only on End cylinder value, for example of 5Gb size of partition. It looks like below.
The above two is just example of making partition. Here i am using the following one.
Page 2: Setup Physical Volumes