0

I'm using OpenStack and I am trying to provision a compute resource on it. I want that compute resource to attach to a volume. We have three things in play.

I need something to,

  1. Create a partition table on first mount.
  2. To create a file system (ext4) on first mount.
  3. To initialize the file system with the things I need.

Does the logic to initialize this volume typically hang out in the cloud-init for the machine? If I initialize it manually, I can mount it using cloud-init's directive for mounts. But without manually installation, how do we instruct user_data to initialize the volume before if necessary before the mount?

What I'm trying to do is store the .git file for a monorepo on an external shared mount. What I would like is on first boot of the sandbox for that to be ready. On subsequent boots/refreshes, I would just like them to run git fetch so they only pull down what's necessary rather than needing to re-clone.

Evan Carroll
  • 2,921
  • 6
  • 37
  • 85

1 Answers1

0

Cloud-init solution

cloud-init accommodates the partitioning with disk_setup

disk_setup:
  /dev/vdb:
    table_type: gpt
    layout: true

And the corresponding filesystem initialization with fs_setup

fs_setup:
- label: repo
  filesystem: ext4
  device: /dev/vdb1
  partition: auto
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85