Create qcow2 images from the CLI without owner VM, possible?

Gabble

Active Member
Jul 23, 2019
10
0
41
Greetings, my goal is to:
  1. create a qcow2 or raw image from the command line (I would prefer qcow2 anyway) without linking it to a new or existing VM;
  2. create a partition table and a file system in it;
  3. mount it, to access data (copy, sync, from a remote source)
  4. unmount the image when finished
I am stuck at 1).
The documentation I read assumes that there must be an existing VM to attach the new image to; but probably I am missing something.

Can anybody help me please?

Proxmox VE 6.1-8

Thanks in advance forn any help you will offer.
Gabriele
 
you can reserve a special VMID and then allocate for that VMID? (the config for that VMID does not have to exist, except if you want to use the GUI). e.g., with pvesm alloc

if you specifically mean qcow2, you can also just use qemu-img to allocate it in an arbitrary path?
 
Thank you Fabian, could you please elaborate a bit more?
If you provide an example, or sample commands, it will be of great avail to me.
 
Code:
pvesm alloc local 999999 vm-999999-disk-foobar.qcow2 1G

Code:
qemu-img create -o 'preallocation=metadata' -f qcow2 test.qcow2 1G

depending on what variant you need..