5

I'm trying to install 20.04 with an auto install config file like this one:

user-data file:

version: 1
identity:
    hostname: hostname
    username: username
    password: $crypted_pass

But the automated install process (leaving everything at defaults) does NOT partition the disk to use all space, even though that seems to be the default setting when I run through the installer manually.

After manually selecting all the defaults, I get this storage section from /var/log/installer/autoinstall-user-data

  storage:
    config:
    - {ptable: gpt, serial: INTEL SSDPEKKF256G8L_BTHH85121P8H256B, wwn: eui.5cd2e42c81a42d1d,
      path: /dev/nvme0n1, wipe: superblock-recursive, preserve: false, name: '', grub_device: true,
      type: disk, id: disk-nvme0n1}
    - {device: disk-nvme0n1, size: 1048576, flag: bios_grub, number: 1, preserve: false,
      type: partition, id: partition-0}
    - {device: disk-nvme0n1, size: 256057016320, wipe: superblock, flag: '', number: 2,
      preserve: false, type: partition, id: partition-1}
    - {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-0}
    - {device: format-0, path: /, type: mount, id: mount-0}

However, it's not clear to me what from here I need to include in my user-data file to just select the "fill disk" option?

1
  • 1
    Hope you do not mind me changing "preseed" to "autoinstall config" preseed is no longer available as of 20.04. You might also want to post this on discourse.ubuntu.com/c/server The creator of this is there and might not visit AU.
    – Rinzwind
    May 27, 2020 at 19:10

2 Answers 2

6

I have not tried this, but the docs suggest a negative value will 'fill'.

Source: https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference#storage

the server installer allows sizes to be specified as percentages of the containing device. Also, a negative size can be used for the final partition to indicate that the partition should use all the remaining space.

edit

I tried this out. Using size: -1 for the final partition did fill the disk. I tried using size: 100% and size: -1 for an LVM Logical Volume to use all the available space and it did not work. The installer errored in align_down in subiquity/models/filesystem.py.

I also tried 100%FREE but subiquity errored on dehumanize_size

I also tried removing the size property for the lvm_partition because the curtin docs say (at https://curtin.readthedocs.io/en/latest/topics/storage.html)

If the size key is omitted then all remaining space on the volgroup will be used for the logical volume.

This does not work as subiquity errors if there is no size property

This is unfortunate as using a percentage for an LVM Volume would be a pretty basic use case

The full storage config I tried.

  storage:
    grub:
      reorder_uefi: False
    swap:
      size: 0
    config:
    - {ptable: gpt, path: /dev/sda, preserve: false, name: '', grub_device: false,
      type: disk, id: disk-sda}
    - {device: disk-sda, size: 512M, wipe: superblock, flag: boot, number: 1,
      preserve: false, grub_device: true, type: partition, id: partition-sda1}
    - {fstype: fat32, volume: partition-sda1, preserve: false, type: format, id: format-2}
    - {device: disk-sda, size: 1G, wipe: superblock, flag: linux, number: 2,
      preserve: false, grub_device: false, type: partition, id: partition-sda2}
    - {fstype: ext4, volume: partition-sda2, preserve: false, type: format, id: format-0}
    - {device: disk-sda, size: -1, flag: linux, number: 3, preserve: false,
      grub_device: false, type: partition, id: partition-sda3}
    - name: vg-0
      devices: [partition-sda3]
      preserve: false
      type: lvm_volgroup
      id: lvm-volgroup-vg-0
    - {name: lv-root, volgroup: lvm-volgroup-vg-0, size: 100%, preserve: false,
      type: lvm_partition, id: lvm-partition-lv-root}
    - {fstype: ext4, volume: lvm-partition-lv-root, preserve: false, type: format,
      id: format-1}
    - {device: format-1, path: /, type: mount, id: mount-2}
    - {device: format-0, path: /boot, type: mount, id: mount-1}
    - {device: format-2, path: /boot/efi, type: mount, id: mount-3}

edit 2

I kept digging into this and it seems that sometimes subiquity stores disk sizes as a float, which led to the uncaught exception. I was actually able to work around this by not using human readable format. E.g. instead of size: 512M, use size: 536870912.

This is a sample storage config that uses the autofill option with property size: -1 and also configures a logical volume to fill a volume group with the property size: 100%

  storage:
    grub:
      reorder_uefi: False
    swap:
      size: 0
    config:
    - {ptable: gpt, path: /dev/sda, preserve: false, name: '', grub_device: false,
      type: disk, id: disk-sda}
    - {device: disk-sda, size: 536870912, wipe: superblock, flag: boot, number: 1,
      preserve: false, grub_device: true, type: partition, id: partition-sda1}
    - {fstype: fat32, volume: partition-sda1, preserve: false, type: format, id: format-2}
    - {device: disk-sda, size: 1073741824, wipe: superblock, flag: linux, number: 2,
      preserve: false, grub_device: false, type: partition, id: partition-sda2}
    - {fstype: ext4, volume: partition-sda2, preserve: false, type: format, id: format-0}
    - {device: disk-sda, size: -1, flag: linux, number: 3, preserve: false,
      grub_device: false, type: partition, id: partition-sda3}
    - name: vg-0
      devices: [partition-sda3]
      preserve: false
      type: lvm_volgroup
      id: lvm-volgroup-vg-0
    - {name: lv-root, volgroup: lvm-volgroup-vg-0, size: 100%, preserve: false,
      type: lvm_partition, id: lvm-partition-lv-root}
    - {fstype: ext4, volume: lvm-partition-lv-root, preserve: false, type: format,
      id: format-1}
    - {device: format-1, path: /, type: mount, id: mount-2}
    - {device: format-0, path: /boot, type: mount, id: mount-1}
    - {device: format-2, path: /boot/efi, type: mount, id: mount-3}

It looks like the float bug may have been fixed with this commit and might be avoided if the automatic installer update feature is used

https://github.com/CanonicalLtd/subiquity/commit/8a84e470c59e292138482a0b1bd7144fbb4644db#diff-1ca44bce35f59e931cbe850119e630db

2

Negative size does work. 2nd partition is set to size -1 and uses all available space.

  storage:
    config:
    - grub_device: true
      id: disk-sda
      path: /dev/sda
      ptable: gpt
      type: disk
      wipe: superblock-recursive
    - device: disk-sda
      flag: bios_grub
      id: partition-0
      number: 1
      size: 1048576
      type: partition
    - device: disk-sda
      id: partition-1
      number: 2
      size: -1
      type: partition
      wipe: superblock
    - fstype: ext4
      id: format-0
      type: format
      volume: partition-1
    - device: format-0
      id: mount-0
      path: /
      type: mount
1
  • negative size work on the last partition only
    – maxadamo
    Jun 7, 2021 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .