Unable to parse directory volume name 'vm-777-disk-0

bruno_afk

New Member
Oct 21, 2022
2
0
1
I'm trying to create template from ubuntu 22.04 cloud image. When i'm selecting local-lvm as storage then everythig is fine, but when i select anything else i get error "Unable to parse directory volume name" This is commands that i'm running:

# Variables
disk_name="Backup" new_id=777 cloud_os_slug="ubuntu-2204 cloud_image_name="focal-server-cloudimg-amd64.img"

# This went fine
qm create $new_id --name "$cloud_os_slug" --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0
qm importdisk $new_id $cloud_image_name $disk_name

# Error is on this step
qm set $new_id --scsihw virtio-scsi-pci --scsi0 $disk_name:vm-$new_id-disk-0

# Other steps are fine
Code:
qm set $new_id --boot c --bootdisk scsi0
qm set $new_id --ide2 $disk_name:cloudinit
qm set $new_id --serial0 socket --vga serial0
qm set $new_id --agent enabled=1

# Storage information
1666557330002.png
 
Hi,
for file-based storages, the volume name is $disk_name:$new_id/vm-$new_id-disk-0.$format rather than $disk_name:vm-$new_id-disk-0. Best to get the volume name from the unused-entry in the config file after importing or from the output of the import command. You also can't be sure it will be XYZ-disk-0 in general. If there is some left-over orphaned volume it could be XYZ-disk-1 ;)

Nowadays you can import while attaching directly, with qm set <ID> --scsi0 <storage ID>:0,import-from=</absolute/path/to/image>. With this you don't need the additional step.
 
  • Like
Reactions: panchuz
Nowadays you can import while attaching directly, with qm set <ID> --scsi0 <storage ID>:0,import-from=</absolute/path/to/image>. With this you don't need the additional step.
Ty, this works greate. Thanks a lot.