Skip to content

Commit 4a4d787

Browse files
committed
fix: Inconsistent virtio disk creation
1 parent dc5a4f8 commit 4a4d787

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,19 @@ qm set $VM_ID --agent enabled=1,fstrim_cloned_disks=1
218218
```
219219

220220
The following commands will perform the following:
221+
* Create a variable to determine the location of our imported disk. This is necessary as some storage pools create the destination directory differently. A variable fixes said inconsistencies.
221222
* Add a CD-ROM to `ide0` (in case you need to reinstall the Virtual Machine at a later date)
223+
* Import the unused disk image as a `virtio0` disk. This requires scsihw `virtio-scsi-pci`
222224
* Add a Cloudinit drive to `ide2`
223225
* Set the boot order to `CD-ROM (ide0) -> Disk (virtio0) -> Network Adapter (net0)` and set the bootdisk to disk `virtio0`
224226
* Set the OS Type to `Linux: 6.x - 2.6 Kernel`
225227
* Add a serial adapter `serial0` and update our display to `serial0`
226228
* (Optional): Set CPU Type to `host`. This is necessary if you plan on running any sort of nested virtualization on said Virtual Machine (e.g., Docker, Hyper-V, etc.)
227229
```bash
230+
export DISK_LOC="$STORAGE_POOL:$(qm config $VM_ID | grep -Po "(?<=unused\d: $STORAGE_POOL:).*")"
231+
228232
qm set $VM_ID --ide0 file=none && \
233+
qm set $VM_ID --scsihw virtio-scsi-pci --virtio0 $DISK_LOC && \
229234
qm set $VM_ID --ide2 $STORAGE_POOL:cloudinit && \
230235
qm set $VM_ID --boot "order=ide0;virtio0;net0" --bootdisk virtio0 && \
231236
qm set $VM_ID --ostype l26 && \

0 commit comments

Comments
 (0)