我正在使用 terraform 和 cloud-init 来设置新的虚拟机。我想要在新 VM 中设置并安装额外的磁盘,并在 LVM 之上使用 XFS 分区。目前我发现允许我做到这一点的唯一方法是:
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 ]
有什么方法可以使用 disk_setup/fs_setup 来实现此目的吗?