Setting up Logical Volumes with LVM: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
This document how to create logical volumes in Alpine using lvm2. | This document how to create logical volumes in Alpine using lvm2. | ||
LVM is collection of programs that allow larger physical disks to be reassembled into "logical" disks that can be shrunk or expanded as data needs change. | |||
In this document we will use a [[Setting up a software raid1 array | software raid1 device]] as physical storage for our logical volumes. We will set up a swap partition and a data partition for [[ Setting up a basic vserver | vservers ]] | |||
=== installing LVM software === | === installing LVM software === | ||
apk_add lvm2 | apk_add lvm2 |
Revision as of 12:07, 17 October 2007
This document how to create logical volumes in Alpine using lvm2.
LVM is collection of programs that allow larger physical disks to be reassembled into "logical" disks that can be shrunk or expanded as data needs change.
In this document we will use a software raid1 device as physical storage for our logical volumes. We will set up a swap partition and a data partition for vservers
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)