Sample Header Ad - 728x90

partitionning additional disks as LVM with cloud-init

2 votes
0 answers
2051 views
I'm using terraform and cloud-init to setup new VMs. I want to have additional disks setup and mounted in the new VM, with XFS partitions on top of LVM. Right now the only way I've found that allows me to do that is with this:
runcmd:
      - [ sgdisk, -e, /dev/sdb ]
      - [ sgdisk, -e, /dev/sdc ]
      - [ partprobe ]
      - [ parted, -s, /dev/sdb, unit, mib, mkpart, primary, '1', "100%" ]
      - [ parted, -s, /dev/sdc, unit, mib, mkpart, primary, '1', "100%" ]
      - [ parted, -s, /dev/sdb, set, "1", lvm, "on" ]
      - [ parted, -s, /dev/sdc, set, "1", lvm, "on" ]
      - [ pvcreate, /dev/sdb1 ]
      - [ pvcreate, /dev/sdc1 ]
      - [ vgcreate, u01, /dev/sdb1]
      - [ vgcreate, u02, /dev/sdc1]
      - [ lvcreate, -l, "100%FREE", -n, oradata, u01]
      - [ lvcreate, -l, "100%FREE", -n, backup, u02]
      - [ mkfs.xfs, /dev/mapper/u01-oradata ]
      - [ mkfs.xfs, /dev/mapper/u02-backup ]
      - [ mount, -a ]
Is there any way I can use the disk_setup/fs_setup for this?
Asked by Edzilla (21 rep)
Oct 12, 2023, 08:19 PM
Last activity: Oct 12, 2023, 08:20 PM