Setting up Logical Volumes with LVM

From Alpine Linux
Revision as of 15:18, 4 October 2007 by Ncopa2 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This document how to create logical volumes in Alpine using lvm2.

What is logical volumes?

Logical volumes are

installing LVM software

apk_add lvm2

Preparing the physical volumes

First we need to tell LVM that de partition is available as a physical volume and can be added to a volume group. In this example we use a software raid array as physical volume.

pvcreate /dev/md0

Preparing the Volume Group

We can then create a volume group and add the physical volume /dev/md0

vgcreate vg0 /dev/md0

If we later need more space we can add additional physcal volumes with vgextend. All physcal disks/partitions added need to be prepared with pvcreate.

In the volume group we can create logical volumes. To create a volume called vservers with size 60G on the volume group vg0 we run

lvcreate -n vservers -L 60G vg0

This volume shows up as /dev/vg0/vservers and can be used as device for mounting. (You will need to create a filesystem first)