1. Home
  2. Training Library
  3. Linux Administration Bootcamp Introduction | CSL4 V2 A3.1 |

Mirroring Logical Volumes

Contents

keyboard_tab
Linux Administration Bootcamp
Installing and Connecting to a Linux System
2
Linux Boot Process and System Logging
33
Disk Management in Linux
36
Partitions
PREVIEW6m 50s
38
User Management in Linux
Shell Scripting with Linux
54
55
Start course
Overview
Difficulty
Beginner
Duration
7h 28m
Students
2
Description

In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows.

Transcript

Just to demonstrate that you can have more than one volume group per Linux system, I'm going to create another VG called VG underscore safe. And I'm just going to pretend that I need the data stored in this volume group to be very safe, hence the name. Of course VGs are made up of Pvs, so let's create a couple of physical volumes for our new volume group. Again, we'll use our old process here of LVM disk scan. See what's available, SDD and SDE are available. So let's go ahead and create those.

Up until this point, we've just been creating one physical volume at a time but you can give the PV create command a list of storage devices. So let's just go ahead and give it both discs at the same time. Okay let's check out our physical volumes with the PVS command and it shows we have those two physical volumes that aren't yet assigned to a volume group. Just like we can provide a list of devices to PV create, we can also give VG create a list of PVs that we want in the volume group. So let's do this VG create, the name, VG underscore safe and then the path to our PVs.

Now if you look at the VGs command, we see VG underscore safe has two physical volumes and no logical volumes at this point because we haven't created any. So let's go ahead and do that now. Let's create a mirrored logical volume. Now this will ensure that an exact copy of the data will be stored on two different storage devices. And we do this with the LV create command, but this time the only slight differences dash M one. So we tell it how many additional copies of our data we want and we want one additional copy. So that means our data will be stored on two disks or have a total of two copies. Again, we'll just give it a size human readable five gigabytes, a name LV underscore secrets

 Let's pretend this is our company secret data. And then we'll give it the volume group name of VG safe. So Let's look at the LVS command and actually it kind of scrolled off to the side, but you can see here in this copy sync column, that it's currently 18.75. And let me just run this command another time or two here. So that copy present sync column indicates if the mirror is synced or not. Now, if it's at 100%, then all the data is synchronized. So let me run this command again.

Okay, at this point, we have exact copies of our data. If you were to replace a failed disc, for example the mirror would need to resync the data from the existing copy to the new disc. While that copy was in progress, the percent would be less than 100. And then when that finished syncing the data to that new device, it would be at 100%. Let's look at the LV's command with the dash A option, which stands for all. The logical volume we created is actually raid one. So a mirror and raid one are the exact same thing. Anyway, when you create a raid logical volume, LVM creates a metadata sub volume that is one extent and size for every data or parody sub volume in the array.

In this example, creating a two way raid one array results in two metadata sub volumes. And those are LV underscore secrets r-meta zero and LV underscore secrets underscore r-meta underscore one and two data sub volumes which are LV underscore secrets underscore r-image underscore zero, as well as r-image underscore one.

Now let's look at the map with PV display. PV display dash M. At the bottom of your screen, you see that LV underscore secrets underscore r-meta, underscore one and LVC secrets r-image underscore one reside on the forward slash dev forward slash SDE discs. It scored off the top of your screen but the output above that is for the dev SDD disc. And that's where the LV secrets are met at zero and LV secrets are image zero live.

To be clear we operate on this logical volume using the name we gave it. For example, let's create a file system on that logical volume and mount it and we'll be using the name that we gave it. So we'll do M-K-F-S dash T-E-X-T four and then the path of VG safe, which is volume group name and then the logical volume name that we gave it.

Okay, let's create ourselves a mount point here. And let's mount our logical volume. So we write to dev VG, underscore safe, LV underscore secrets and let the logical volume manager handle all the mirroring and all the sub volumes and all that metadata and everything else. We just use this false system like any other and we use the name that we gave the logical volume manager. So again, anything we were to write in forward slash secrets will actually be written to two underlying storage devices without us having to do anything extra.

About the Author