From b82a47ee52984c3a939f775e2f84bbe32add4913 Mon Sep 17 00:00:00 2001 From: colin Date: Sun, 11 Aug 2024 18:59:51 -0400 Subject: [PATCH] Update install.sh --- install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index d39e10a..2acf1ea 100644 --- a/install.sh +++ b/install.sh @@ -49,9 +49,11 @@ echo "Importing the downloaded Ubuntu disk to storage ($STORAGE)..." qm disk import $VM_ID $IMG_NAME $STORAGE check_command "Importing disk to storage" -# Step 5: Attach the new disk to the VM as a SCSI drive on the SCSI controller -echo "Attaching the new disk to the VM..." -qm set $VM_ID --scsihw virtio-scsi-pci --scsi0 $STORAGE:vm-$VM_ID-disk-0 +# Step 5: Identify the unused disk and attach it to the VM as a SCSI drive on the SCSI controller +echo "Attaching the imported disk to the VM..." +DISK_ID=$(qm config $VM_ID | grep "^unused" | awk -F ':' '{print $1}') +qm set $VM_ID --scsihw virtio-scsi-pci --scsi0 ${STORAGE}:vm-${VM_ID}-disk-0 +qm set $VM_ID --delete $DISK_ID check_command "Attaching disk to VM" # Step 6: Add cloud init drive