TransWikia.com

terraform - shall one use simple disk or linux LVM?

Server Fault Asked by Wojtas.Zet on November 4, 2021

Is there any drawback of using LVM disks in terraform managed virtual machines?

Currently I come to the project where all disks are simple linux disks, but terraform is unable to resize them up without destroying them (data loss). And as everything grows there is from time to time need for that.

I use terraform with vsphere provider for virtual machines and saltstack for filesystem creation.

My idea was to move everything to LVM disks… I wonder is there any fallout from using LVM with terraform? Could it be done better than combining terraform/saltstack?

Snippets of my terraform code:

  disk {
    label        = "disk-lvm"
    unit_number  = 2
    attach       = true
    path         = "storage/my-lvm.vmdk"
    disk_sharing = "sharingNone"
    datastore_id = data.vsphere_datastore.shared_vm.id
  }

And saltstack, disk seens as /dev/sdc

/dev/sdc:
  lvm.pv_present

data_vg:
  lvm.vg_present:
  - devices: /dev/sdc

lv_data:
  lvm.lv_present:
  - vgname: d_vg
  - size: 300.9G

Mount my-lvm storage:
  mount.mounted:
    - name: /data
    - device: /dev/mapper/d_vg-lv_data
    - fstype: xfs
    - opts:
        - defaults
    - mkmnt: True
    - persist: True

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP