-
-
Save zealfire/f4af4866d629fb2fd78ecde1ce0507b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Logical volume mangaer is widely used technique for deploying logical rather than physical storage. With LVM "logical" partitons can span across physical harddrive and can be resized. | |
So, in days when techonology was not so advanced, need to store data was less and hence we had physical drives of smaller size but with advance in technology the need to store data grew and hence the size of the physical drive so they were stacked one over the other to incress the size of storage. The problem with this was if i had a physical volume 0f 40gb stacked over another 40gb i will be not be able to store continuos data which extend upto 60gb and for that we need a hardrive of 80gb. This was costly job. | |
So they come up "LVM" which allows mutiple harddrive to combine into one,fooling OS that we are actually using single hard drive instead of mutilple so the OS can span a data across a multiple hard drive thinking as one and this reduce the need of purcahsing new hard drive. | |
So these physical drive are called "Physical Volume" and these drive are combined to create Volume Group". Once the "Volume Group" is created the OS thinks it has a single hardrive(which is combine of mutiple). | |
So now from this Volume Group we can create a logical partition of any size which is known "Logical. | |
Coming back to how to confugure LV, i can only guide you to CLI steps | |
Steps to create LV through CLI | |
1. Assign Tag | |
Once you connect you hard drive you need to tell them that are going to be part of Volune Group by assigning tag to them. So i have this physical drive which is /dev/sda6 and /dev/sda7 | |
# fdisk /dev/sda6 | |
You will be asked for option in next line so press | |
:t hit enter | |
:8e hit enter(this tell the hardrive that you are now a part of LVM) | |
Repeat it for /dev/sda7 as well | |
2. Initialize Physical volume | |
#pvcreate /dev/sda6 /dev/sda7 | |
To view if the drive has been initialized | |
#pvdisplay | |
3. To create Volume Group | |
I want to create a volume group name Bigdata | |
#vgcreate bigdata /dev/sda6 /dev/sda7 | |
#vgdisplay | |
4. To create LV from VG | |
#lvcreate -L 1200M n bigdatalv1 bigdata | |
-L : it is option for providing size | |
1200M is the size in Mb | |
n: is for naming your logical volume, here i have named it bigdatalv1 followed by the VG name. | |
5. To format Logical Volume | |
#mkfs.ext4 /dev/bidata/bigdatalv1 | |
6. To mount LV so that it can accesibile, we need to create a directory and mount on it | |
#mkdir /bigdatadir | |
#mount /dev/bidata/bigdatalv1 /bigdatadir | |
7. To extend VG if we have new hard drive to extend follow step1 and 2 then below cmd | |
#vgextend bigdata /dev/sda8 | |
8. To reduce VG if we want to remove a hard drive from VG | |
#vgreduce bigdata /dev/sda7 | |
9. To extend LV | |
#lvextend -L +100M /dev/bigdata/bigdatalv1 | |
10. To reduce LV | |
#lvreduce -L -100M /dev/bigdata/bigdatalv1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment