Skip to content

lvm usage cases #1240

@karamelichkin

Description

@karamelichkin

Does anyone successfully use LVM as a storage device for their virtual machines?

`locals {
disk_sizes = {
"30GB" = 32212254720 # 30 * 1024^3
}

provider "libvirt" {
alias = "kvm3"
uri = "qemu+sshcmd://[email protected]/system"
}

resource "libvirt_pool" "st0_pool_kvm3" {
provider = libvirt.kvm3

name = "st0-storage"
type = "logical"

source = {
name = "st0"
}

target = {
path = "/dev/st0"
}
}

resource "libvirt_volume" "alpine_base_empty" {
provider = libvirt.kvm3

name = "alpine-3.22-base"
pool = libvirt_pool.st0_pool_kvm3.name
capacity = local.disk_sizes["30GB"]
}`

# lvs -a st0
  LV                         VG  Attr       LSize  Pool Origin                     Data%  Meta%  Move Log Cpy%Sync Convert
  alpine-3.22-base           st0 swi-a-s---  4.00m      [alpine-3.22-base_vorigin] 0.00                                   
  [alpine-3.22-base_vorigin] st0 ori-a-s--- 30.00g                                                                        

Is it possible to avoid using thin provisioning methods with LVM storage - not creating base images, snapshots. Use raw LVM instead, then perform necessary operations through Terraform null_resource?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions