Linux Demo: Using LVM

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this demonstration we're going to practice working with logical volume manager or LVM so in order to create an LVM volume on our system here we need to first define our physical volumes then we need to create a volume group from those physical volumes and then finally within that volume group define one or more logical volumes now in this system I have three hard disks currently set up I have SD a SD b and SDC now SD a is my system volume where my operating system resides where my home directories are and so on we're not going to touch SDA in fact SDA already has several LVM logical volumes defined on it they were created when the system was initially installed and you'll see those as we go through the demonstration however SDB and SDC are new hard disks they're blank there's nothing on them we want to use them to create LVM logical volume so the first thing we need to do is create physical volumes out of SD b and SD c to do this i first need to switch to my route user account i have to have root level privileges to manage the storage in the system and now let's create a physical volume out of SD B this is done using the PV create command you simply enter PV create and then the name of the device file slash dev slash SDB and we're told that we have a new physical volume created for LVM out of SD B let's do the same thing for C so at this point we should have two physical volume defined for LVM SD b and SD c let's verify this using the PVC scan command and notice that it tells us we have three physical volumes to find the first one is one that was created during the system installation on SDA we're not going to be concerned with that one we are going to be concerned with these two physical volumes here SD b and SD c notice that each one is about 20 gigs in size so by defining these as LVM physical volumes we can now aggregate the space from these two storage devices and then create a logical volume on them now currently we can't yet because they are still running in pendant leave each other in order to define logical volumes on these two devices we need to first add them to a single volume group now we currently have one volume group defined on the system its Fedora underscore FS 1 again this was created during system installation we're not going to work with that volume group instead what we want to do is create a new one so we do the VG create command and then we specify the name of the volume group we want to create let's call it data and then we can specify which physical volume we want to initially add to that volume group let's add /dev / SD B so at this point we've created the volume group named data and we've added one of the physical volumes to that group now it's important to note that the VG create command can only be used to create the volume group it cannot be used to modify a volume group such as to add another physical volume to it if we want to add another physical volume to an existing volume group we need to use a different command this command is eg extend we run VG extend we specify the name of the volume group the existing volume group because remember we're modifying it we're not creating it now and then we specify the name of the physical volume that we want to add to that existing volume group /dev / SD sea so at this point we should have a single volume group defined and the two physical volume should be members of the same volume group let's run the PV scan command again and verify that this is the case and it is we have a volume group named data now and s DB and s DC are both members of that volume group now with the volume group defined we can now finally define logical volumes from within that volume group we could define just one logical volume or we could define many logical volumes for our purposes let's define two different logical volumes within the data volume group we'll do a volume named shared and a volume named private the shared volume will be used for users to share data back and forth while the private volume will contain information that's proprietary in nature and access will be restricted so to define these two logical volumes we use the LV create command we enter LV create and then a - capital L followed by the size of the volume that we want to create now the shared volume will have lots of users data on it so it'll need to be a little bit bigger in size let's specify that it'd be 25 gigabytes in size now we have to provide a name for the new volume again we said it would be called shared and then we have to specify which volume group we want to create this volume within and in this case we're going to use the data volume group that we just defined up here using our two physical volumes hit enter the logical volume shared has been created we can verify this using the LV scan command notice here we have a logical volume now defined /dev and then the name of the volume group data and then the name of the logical volume shared and has 25 gigs in size these other two volume groups were defined when the system was created notice they're in a totally different volume group they're in the Fedora underscore fs1 volume group we have a swap partition and we have our root partition defined within that volume group but again we're not working with that one today we're dealing strictly with the data volume group let's go ahead and run the same command again this time to create the private volume that we talked about earlier let's make it a little smaller let's just make it 10 gigs in size we'll change the name to private but we will create it within the same volume group data and the logical volume private is created will run LV scan again and we see that we have two logical volumes defined within the same volume group shared and private now if we look back up here real quick notice that s DB is 20 gigs in size s DC was 20 gigs in size but down here we have a 25 gig volume defined name shared and a 10 gig volume to find one of the great things about L VM is the fact that all of the space on these two volumes up here have been aggregated into basically just a big pool of available space within that pool we defined these two volumes and as we did so the physical disk boundaries associated with the actual hard disk drives were completely irrelevant it didn't matter that we created a 25 gig volume with two hard disk drives that only 20 gigs and sides with LVM the volume can easily span two different physical hard disk drives not a problem it's very happy to work that way so at this point our logical volumes have been created we would now go ahead and create file systems on those logical volumes just like we would a standard disk partition and we would mount them in the file system just like we would a standard disk partition as well we'll cover those in separate demonstrations in this demonstration we first used LVM to define physical volumes from two hard disk drives installed in the system we then to find a volume group from those physical volumes and then within that volume group we defined two logical volumes
Info
Channel: The Linux Man
Views: 2,066
Rating: 4.9428573 out of 5
Keywords: Linux
Id: 9PJRmRq0jHI
Channel Id: undefined
Length: 7min 49sec (469 seconds)
Published: Thu Nov 24 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.