Additional Disk partition and Mount by cloud-init

nbanik

New Member
Apr 22, 2024
24
2
3
Hello Experts,
I was trying to additional disk setup in vm using cloud-init config:
I've 2nd disk vdb and want to make two (vdb1 & vdb2) parition each will be having 50% of space and should mount
vdb1 to /data1 and
vdb2 to /data2.

Here is my config:


YAML:
resize_rootfs: false
disk_setup:
    /dev/vdb:
        table_type: 'mbr'
        layout:
        - 50
        - 50
        overwrite: true

fs_setup:
    - label: DATA1
      filesystem: 'xfs'
      device: '/dev/vdb'
      partition: vdb1
      overwrite: true
    - label: DATA2
      filesystem: 'xfs'
      device: '/dev/vdb'
      partition: vdb2
      overwrite: true

runcmd:
  - [ partx, --update, /dev/vdb ]
  - [ mkfs.xfs, /dev/vdb1 ]
  - [ mkfs.xfs, /dev/vdb2 ]
  - [ partprobe ]

mounts:
    - [vdb1, /data1, auto, "defaults,discard", "0", "0"]
    - [vdb2, /data2, auto, "defaults,discard", "0", "0"]

But OS booting is stuck.
1716210147521.png

Whats wrong in my config?