User Tools

Site Tools


creating_lvms

This is an old revision of the document!


Creating Volume Groups

Below is the command used to create a volume group from one or more physical volumes.

vgcreate vg1 /dev/device1 /dev/device2
When physical volumes are used to create volume group, the disk space is divided into 4mb extents. This means that the logical volumes are increased and decreased by this size.

Representation

Logical Volume groups will be represented as:

/dev/vg/lv/
For example if you create 2 volume groups and 3 logical volumes it will be displayed as:
/dev/vg1/lv01
/dev/vg1/lv02
/dev/vg1/lv03
/dev/vg2/lv01
/dev/vg2/lv02
/dev/vg2/lv03

Extending a volume group

Below is how to extend a volume group by adding another physical volume:

vgextend vg1 /dev/device4

Displaying Volume Groups

There are 2 commands you can use to display the current groups:
The vgs command provides volume group information in a configurable form, displaying one line per volume group

vgs
The vgdisplay command displays volume group properties (such as size, extents, number of physical volumes, etc.) in a fixed form
vgdisplay

Removing Physical Volume from Volume Group

If you wish to remove a physical device from a volume group you will first need to make sure that the device is not being used. If the device IS being used then you will need to move the data off (pvmove). Below shows an output of a full device.

pvdisplay /dev/device2
Example output:
-- Physical volume ---
PV Name               /dev/device2
VG Name               vg
PV Size               1.95 GB / NOT usable 4 MB [LVM: 122 KB]
PV#                   1
PV Status             available
Allocatable           yes (but full)
Cur LV                1
PE Size (KByte)       4096
Total PE              499
Free PE               0
Allocated PE          499
PV UUID               Sd44tK-9IRw-SrMC-MOkn-76iP-iftz-OVSen7
Once you move off the data you can use vgreduce:
vgreduce vg1 /dev/device2


creating_lvms.1448277335.txt.gz · Last modified: 2024/05/23 07:26 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki