I am using cloud-init to setup an instance in oracle cloud.
I have the following yaml to create a partition on a drive, format it for ext4 and mount it.
#cloud-config
disk_setup:
/dev/sdb: {layout: true, overwrite: true, table_type: gpt}
fs_setup:
- device: /dev/sdb
- filesystem: ext4
- label: data
- partition: auto
mounts:
- [ /dev/sdb1, /scratch ]
However, this is not creating the partition that I expect should be created in fs_setup
# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 50.0 GB, 50010783744 bytes, 97677312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: gpt
Disk identifier: AEAC51C9-5D28-48CB-82FF-1B7312827FEB
Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 17188863 8G Linux swap
3 17188864 97675263 38.4G Microsoft basic
Disk /dev/sdb: 549.8 GB, 549755813888 bytes, 1073741824 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
I dont see any errors in cloud-init.log or in /var/log/messages
My version of cloud-init is
# cloud-init --version
/bin/cloud-init 19.4
Here is the effective cloud-init file from /var/lib/cloud/instance/cloud-config.txt
#cloud-config
from 2 files
fdisk.yaml
cloud-init.yaml
disk_setup:
/dev/sdb:
layout: true
overwrite: true
table_type: gpt
fs_setup:
- device: /dev/sdb
- filesystem: ext4
- label: data
- partition: auto
mounts:
- /dev/sdb1
- /scratch
runcmd:
- chown "fdaud:root" /scratch
users:
- gecos: Feroze Daud
groups: sudo
homedir: /home/fdaud
name: fdaud
shell: /bin/bash
ssh_authorized_keys:
- ssh-ed25519 REDACTED
sudo:
- ALL=(ALL) NOPASSWD:ALL
...
If I run the disk_setup section manually using cloud-int, it works fine.
any ideas what I am doing wrong?