e42.uk Circle Device

 

Quick Reference

More LVM Howto

More LVM Howto

This is actually a discussion on lvm2 on Alpine Linux and is used as a base for a drbd setup.

Create the Physical Volume

pvcreate /dev/vdb

The above just uses all the space on /dev/vdb without having to worry about a partition table.

Create the Volume Group

A Volume Group is where logical volumes will be created.

vgcreate local /dev/vdb

Create a Logical Volume

Logical Volumes are where data is actually stored.

vlcreate -L 8G -n replicated0 local

The above command creates an 8 GiB volume called replicated0 in the volume group local.

Create a volume that has a mirror copy called rep0 in the local volume group, this command requires two physical volumes to be assigned to the local group.

lvcreate --mirrors 1 --type raid1 -l 100%FREE --nosync -n rep0 local

List all Volumes

Physical Volumes:

pvdisplay

Volume Groups:

vgdisplay

Logical Volumes:

lgdisplay

Scan for Volumes

lvscan

Delete a Logical Volume

lvchange -an /dev/local/replicated0

Check that the volume is inactive:

lvscan

Remove the volume:

lvremove /dev/local/replicated0

Or bring it back from the inactive state:

lvchange -ay /dev/local/replicated0

See that the volume is gone:

lvscan

References

Quick Links: Techie Stuff | General | Personal | Quick Reference