[SOLVED] CLI - set LXC disksize during creation

TodorPetkov

Well-Known Member
Mar 21, 2020
60
9
48
Hello,

I am trying to create container from cli using the following command:

pct create 101 local:vztmpl/fedora-33-default_20201115_amd64.tar.xz --hostname ct101 --arch amd64 --cores 2 --memory 1024 --net0 name=eth0,bridge=vmbr1,firewall=1,gw=10.10.10.1,ip=10.10.10.6/24,tag=10,type=veth --ostype fedora --swap 0 --unprivileged 1 --passwo rd 123456 --storage local --rootfs volume=local:101/vm-101-disk-0.raw,size=14G

I am getting an error that volume does not exist, which is to be expected, since nothing is created yet, but in the same time some people say it's working (https://forum.proxmox.com/threads/custom-disksize-and-storage-with-pct-create.54928/)

Is there a way to pass the disksize during creation or I need to run "pct resize" once it's created?

PVE version is 6.3-1, lxc is 4.0.6-2

Thanks in advance
 
no? please read the linked documentation, it tells you how to allocate a volume of a certain size when creating a container..
 
Thanks, I managed it. In case someone else needs to do this in the future:
pct create 200 local:vztmpl/fedora-33-default_20201115_amd64.tar.xz --hostname ct200 --arch amd64 --cores 2 --memory 1024 --net0 name=eth0,bridge=vmbr1,firewall=1,gw=10.10.10.1,ip=10.10.10.30/24,tag=10,type=veth --ostype fedora --storage local --swap 0 --unprivileged 1 --password PASSWORD --rootfs local:20

Of course, change "PASSWORD" with something stronger;)