How to set root device size when creating new instance?

Hmm, ok that seems a little unsatisfactory in general? So how are others managing this?

Say you want to do some automated creation of instances, but you don’t have unlimited disk space. So you create your default profile to set a root filesystem to be say 10GB. However, then you want to create some instance, which for whatever reason needs a much larger root filesystem, say 50GB.

I presume there must be a way to either create an initial image with no files, resize the filesystem, then re-run “launch” to copy in the filesystem? I’m using LVM if that affects the instructions? Note, I know how to resize the filesystem after the instance is created (“lxc config device override instance-name root size=50GB”), the question is how to integrate that into the instance build process??

However, can I suggest that this sounds like a right old b@ll ache? Could I ask for a feature request to allow the initial default profile to be overridden when creating an instance??!! It would be massively easier to be able to do something along the lines of:

lxc launch myimage new-inst-name -d root,size=50GB

given:

# lxc profile show default
config: {}
description: Default LXD profile
devices:
  root:
    path: /
    pool: vg_fast
    type: disk
name: default

# lxc storage show vg_fast
config:
  lvm.thinpool_name: LXDThinPool
  lvm.vg.force_reuse: "true"
  lvm.vg_name: vg_fast
  source: vg_fast
  volatile.initial_source: vg_fast
  volume.block.filesystem: xfs
  volume.size: 2500MB
description: ""
name: vg_fast
driver: lvm

It feels baffling to me that the simplest way to change the size of the initial size of an instance is to edit the defaults for your storage pool, create the instance and then revert the changes on the storage pool?? Surely there must be a simpler method??

(Background: In my case, nearly all my root filesystems are tiny, like much less than 1GB, so I prefer to keep instances tiny. However, every so often I need to create other instances that might be more like the defaults images: sizes, and this very moment I’m trying to migrate some old linux vserver images, one of which includes the data and so is about 1TB. I don’t want my default instance size to need to be in the TB range, just so that I can start up the odd TB sized root file system? Crazy…)