My `pct create` script: seeking feedback, have questions about `--storage`

johnnyutahh

Member
Sep 19, 2020
31
7
8
39
1. can anyone find problems or offer general feedback on the script below?

(The IP addresses have been redacted. Said script seems to run fine in initial testing.)

2. I have questions about the --rootfs vs --storage options as noted in my post reply below.

3. Is there a collection of example scripts like these, say in some wiki or github/gitlab repo?

4. also: what are the fundamental differences between pct and pvesh; eg: why use one over the other?

Code:
cores=4
cpuunits=1024
memory=8192
swap=512
rootfs_storage=8

pct create $node_id                                              \
    local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz      \
    --cores $cores --cpuunits $cpuunits                          \
    --memory $memory --swap $swap                                \
    --hostname $node_fqdn                                        \
    --net0 name=eth0,ip=$ip_address/32,bridge=vmbr0,gw=$gateway  \
    --rootfs local-lvm:$rootfs_storage                           \
    --storage local-lvm                                          \
    --ssh-public-keys /root/.ssh/authorized_keys                 \
    --onboot 1

# maybe use this later
#   --net1 name=eth1,ip=x.x.x.2/32,bridge=vmbr1  \

pct start $node_id
 
Last edited:
Can someone characterize the difference in these 2 storage/filesystem-related parameters? Namely, why are there 2 different parameters for seems like the same or similar thing?

Code:
--rootfs local-lvm:8
--storage local-lvm

man pct does not initially shed much light on this. It reads:

Code:
       --storage <string>
           Target storage for full clone.


...and I'm not sure exactly what that means. (I'm a Proxmox newbie. I could guess what it means and test it out, but I'm short on time to do that immediately.)
 
Last edited:
with '--storage', you set the storage where the rootfs mp volume will be created. with '--rootfs', you can provide more specific options, like size or more advanced features. you can provide almost everything that 'pct set' can do at creation time. for restore, a bit more logic applies - see the documentation: https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_backup_and_restore
 
with '--storage', you set the storage where the rootfs mp volume will be created.

Thanks @fabian. What does mp volume refer to? Some reference to lvm-based multipathing (mp), perhaps? If so, why does your not mention multipathing specifically? It seems to me that multipathing is not an essential feature to the above discussion/concepts - but maybe I'm missing something?
 
no, mp == mountpoint (as in, the corresponding config key is called 'mpX' where X is some number)