I can't use the script to create a vm

findeque

New Member
Jan 14, 2023
1
0
1
Meppel
Hello, I want to create a vm using the script, but an error occurs:
Code:
unable to create VM 300 - can't activate LV '/dev/pve/vm-300-disk-0':   Failed to find logical volume "pve/vm-300-disk-0"
  Logical volume "vm-300-disk-0" created.
successfully created 'ssd:vm-300-disk-0'

Script:
Code:
# set vm id
id=300


# create image directory, download and uncomporess
mkdir -p /var/lib/vz/images/${id}
curl --location https://github.com/pocopico/tinycore-redpill/releases/download/v0.9.4.0/tinycore-redpill.v0.9.4.0.img.gz --output /var/lib/vz/images/${id}/tinycore-redpill.v0.9.4.0.img.gz
gzip --decompress /var/lib/vz/images/${id}/tinycore-redpill.v0.9.4.0.img.gz --keep


# create vm
qm create ${id} \
  --args "-drive 'if=none,id=synoboot,format=raw,file=/var/lib/vz/images/${id}/tinycore-redpill.v0.9.4.0.img' -device 'qemu-xhci,addr=0x18' -device 'usb-storage,drive=synoboot,bootindex=5'" \
  --cores 2 \
  --cpu host \
  --machine q35 \
  --memory 2048 \
  --name DSM \
  --net0 virtio,bridge=vmbr11 \
  --numa 0 \
  --onboot 0 \
  --ostype l26 \
  --scsihw virtio-scsi-pci \
  --sata0 ssd:vm-${id}-disk-0,discard=on,size=100G,ssd=1 \
  --sockets 1 \
  --serial0 socket \
  --serial1 socket \
  --tablet 1


# create disk for sata0
pvesm alloc ssd ${id} vm-${id}-disk-0 100G

I don't know what caused it and how to fix it. Help me, pls
 
The order of operation should be:
1 create vm without disk
2 create disk
3 set disk

Or "man qm":
Code:
Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the import-from parameter to import from
           an existing volume.

I, also, wouldnt use the args option, but just import-from the img to newly created disk.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox