LVM Commands

  Logical Volume Manager

Physical Volume Commands

Display the Physical Volumes

  • Physical volumes will not show until they have been added to a Volume Group!
pvdisplay /dev/sdx

 

Physical Volumes Show (Short?)

pvs

 

Volume Group Commands

Create Volume Groups

vgcreate <groupName> /dev/sdx1 /dev/sdx2 ...

 

Display Volume Groups

vgdisplay <-v> </dev/GROUPNAME>

-v: Show Physical Volume information

 

Volume Group Show (Short?)

Limited display of all available volume groups

vgs

 

Create Logical Volumes

lvcreate -L NNGB -n LOG-VOL-NAME VOL-GROUP-NAME <START-DISK><:EXTENTS-RANGE> <NEXT-DISK><:EXTENTS-RANGE>
lvcreate -L 50GB -n lvlab /dev/myvolgroup

-L: Size in MB, GB, TB
-l (lower case): Size in PE
-n: Name
-v, -vv, -vvv, -vvvv:

  • Increasing amount of displayed detail
  • Must be at the end of the command?
    • lvcreate -L NNGB -n LOG-VOL-NAME VOL-GROUP-NAME -vv

<START-DISK>: Optional

  • Define which PVs to take space from.
  • You can define multiple disks.  If you do not define HOW to share the disk space taken, it will split it evenly. (See <EXTENTS-RANGE> below)
lvcreate -l 5000 -n lvlab /dev/myvolgroup /dev/sdc2

<START-DISK><:EXTENTS-RANGE>: Optional define the range of extents to take from each designated disk

lvcreate -l 50 -n lvlab /dev/myvolgroup /dev/sdc2:0-24 /dev/sdc3:50-74
lvcreate -l 50 -n lvlab /dev/myvolgroup /dev/sdc2:0-24:200-

* In the last example all remaining space required will be taken from extent 200 onward.

Display Logical Volume Information

lvdisplay /dev/VOL-GROUP-NAME/LOG-VOL-NAME

 

Logical Volume Show (Short?)

Limited display of all available logical volumes

lvs

 

Remove a Logical Volume

lvremove /dev/VOL-GROUP-NAME/LOG-VOL-NAME

This process will be difficult if the volume is in use.

6:00

LEAVE A COMMENT