Comment 2 for bug 1983041

Revision history for this message
Dan MacDonald (allcoms) wrote :

Since my previous comment I have learned that Ubuntu server saves its cloud-init install config, including disk partitioning in /var/log/installer/autoinstall-user-data

Great! So that's got me an almost fully working config. Now I just need to genericise it for use in my script which should only amount 3 things:

* Change gpt to mbr

* Remove the disks serial ID and any disk UUID sort of stuff

* Get cloud init to use the full space of the disk

Its that third point I'm not quite sure how to achieve currently. Subiquity inserts a size: field for each partition it creates into autoinstall-user-data. I tried removing the size: field hoping that it would default to using the full remaining space after the bios boot partition but subiquity didn't like this.

Does a disk size need to be specified for each partition? Is there no "use rest of space on disk" cloud-init function I can use when defining a partition?

Here's my updated, non-working attempt at a cloud-init file:

#cloud-config
autoinstall:
  apt:
    disable_components: []
    geoip: true
    preserve_sources_list: false
    primary:
    - arches:
      - amd64
      - i386
      uri: http://gb.archive.ubuntu.com/ubuntu
    - arches:
      - default
      uri: http://ports.ubuntu.com/ubuntu-ports
  drivers:
    install: false
  identity:
    hostname: ltspbase
    password: $6$aPM6zZtkZeD2rgbG$oSAwiMQ9GH/5gs5ZaNPlnIIpp6k7eFQ4ZSw7aTTNZRfnSMoUi7MRI3GXjalcB6ykXYF8SUQE5c6CPsvlXOC1w1
    realname: ubuntu
    username: ubuntu
  kernel:
    package: linux-generic
  keyboard:
    layout: gb
    toggle: null
    variant: ''
  locale: en_GB.UTF-8
  network:
    ethernets:
      enp0s3:
        dhcp4: true
    version: 2
  ssh:
    allow-pw: true
    authorized-keys: []
    install-server: false
  storage:
    config:
    - ptable: mbr
      path: /dev/sda
      wipe: superblock-recursive
      preserve: false
      name: ''
      grub_device: true
      type: disk
      id: disk-sda
    - device: disk-sda
      size: 1048576
      flag: bios_grub
      number: 1
      preserve: false
      grub_device: false
      type: partition
      id: partition-0
    - device: disk-sda
      wipe: superblock
      flag: ''
      number: 2
      preserve: false
      grub_device: false
      type: partition
      id: partition-1
    - fstype: ext4
      volume: partition-1
      preserve: false
      type: format
      id: format-0
    - path: /
      device: format-0
      type: mount
      id: mount-0
  updates: security
  version: 1