Skip links

Logical Volume Manager (LVM), a practical approach

June 1, 2011 at 9:37 PM - by Freek Lijten - 5 comments

Tags: , ,

In this article I explained the concepts behind the Logical Volume Manager (LVM). In this continuation I will have a look at the commands necessary to actually setup an environment with logical volumes. I will once again use the scenario of our storage machine as an example.

Our storage machine has three "disks". Two are the result of a raid 5 setup (/dev/sda and /dev/sdb) and one is a single disk (/dev/sdc) where the operating system lives. So of the three, sdc is where the OS is and both /dev/sda and /dev/sdb are fully used in their respective physical volumes (PV). You can run the command pvdisplay to see what PV's exist on your server. In the case of storage the output looks like this:

Fig. 1: The output of pvdisplay on our storage server

Two 2.73TB PV's are the base of our machine. So how where these PV's created? The command in question is pvcreate (You might start to notice a certain naming pattern ;) ). It takes several options and one ore more locations (remember, a PV can use a disk or a partition on a disk). The commands to create both PV's for storage look like pvcreate /dev/sda and pvcreate /dev/sdb.

Now, for the next step we need to create the volume group (VG). The command in question is vgcreate. Using this command to use the two PV's as base for our new volume group looks like this: vgcreate vg0 /dev/sd[a-b]. The result of this action can be seen below: 

Fig. 2: The output of vgdisplay on our storage server

Time for the last step, creating a logical volume. Just as with our volume group, there's only one logical volume. The command is, you guessed it, lvcreate. To be more exact, this command has delivered the result below: lvcreate -L 5.46T -n lv0 vg0. A 5.46TB large logical volume called lv0 is created inside the volume group called vg0:

Fig. 3: The output of lvdisplay on our storage server

So I have a logical volume, now what?

A logical volume is a block device, so you can use it as you would any other block device (bonus info: read on (creating) Block device drivers). In the case of our storage machine, the newly created logical volume /dev/vg0/lv0 was added as a partition and mounted at /data.

So this was no rocket science, but I liked the idea of following the theory up with some practical information. It is not exhaustive at all, but the manpages of the different commands offer all information you're likely to need. I'd recommend using an old computer you don't use anymore to toy with these concepts so you will not ruin anything particularly valuable ;)

Share this post!

Comments

  1. is bitcoin revolution a scamis bitcoin revolution a scam Wrote on October 30, 2019 at 12:03:25 PM

    Binance is a cryptocurrency exchange based in Malta.

  2. bitcoin revolution alexander klöppingbitcoin revolution alexander klöpping Wrote on November 7, 2019 at 5:07:00 PM

    So I only bought Kindle ebooks for traveling.

  3. http://topkeywords.nethttp://topkeywords.net Wrote on November 14, 2019 at 4:13:38 AM

    So, when you read cryptocurrency”, think digital gold.

  4. bitcoin loophole dragons den pitchbitcoin loophole dragons den pitch Wrote on November 17, 2019 at 8:05:06 AM

    Also, different features akin to the client help and demo buying and selling platform work excellently nicely.
    The client feedback system is clear. There are quite a few elements which have determined that the system mentioned in this overview is legit,
    genuine, and reliable. You should login in an effort to remark or rate a assessment.
    The plain conclusion is that the narrative has been rehashed and minor adjustments made with a purpose to
    make it seem much less apparent. And, that’s
    necessary if you would like to take a position correctly and
    make actual cash. In a moment, I’ll show you why you'll only
    lose money with Bitcoin Loophole. In this text, we'll explore this platform and clarify why we imagine it’s scamming its traders.
    As defined above, most of such rip-off sites use unregulated brokers of their plot to fraud traders.
    The benefits for skilled traders come from the numerous commerce-optimizing and enhancing options that expert traders can easily utilize.

  5. bitcoin loophole videobitcoin loophole video Wrote on November 19, 2019 at 2:51:44 AM

    Bacana. Também não sou especialista, na verdade acho que o mercado é tão recente
    que nem deu tempo de alguém se intitular como expert no assunto.

    Penso que o fato do Bitcoin ser um dinheiro "da internet" e sem fronteiras pode mudar bastante coisa nos meios de pagamentos
    atuais

Leave a comment!

Italic and bold

*This is italic*, and _so is this_.
**This is bold**, and __so is this__.

Links

This is a link to [Procurios](http://www.procurios.nl).

Lists

A bulleted list can be made with:
- Minus-signs,
+ Add-signs,
* Or an asterisk.

A numbered list can be made with:
1. List item number 1.
2. List item number 2.

Quote

The text below creates a quote:
> This is the first line.
> This is the second line.

Code

A text block with code can be created. Prefix a line with four spaces and a code-block will be made.