Reputation: 43
We currently deploy virtual machines (vesphere) with an variable amount of disks using dynamic disk block. In linux we have to format/mount etc. them manually later. Now I want to automate that too with a script executed from terraform on the operating system.
But how can I identify the disks? Lets assume I attach 3 additional disks to a VM. I could hope and assume that disk 1 is /dev/sdb, disk 2 is /dev/sdc and so on. But thats not really how I want to apply that. Is there a way to put a label on the disk that is actually seen in the operating system (rhel linux) so I can be 100% sure that I work with the disk I want to?
dynamic "disk" {
for_each = var.data_disks
content {
label = "disk${disk.value["lun"]}"
size = disk.value["disk_size_gb"]
filesystem = disk.value["filesystem"]
mountpoint = disk.value["mountpoint"]
mountopts = disk.value["mountopts"]
unit_number = disk.value["lun"]
storage_policy_id = var.vsphere_storage_policy_id
eagerly_scrub = var.eagerly_scrub
thin_provisioned = var.thin_provisioned
}
}
filesystem, mountpoint and mountopts are things I add over a json file and plan to use for the bash-script. The "label" is not available in linux.
Thanks in advance
Upvotes: 1
Views: 844