From 5ef4ea1ad39cfaef33329ebd5c5336d7835193a8 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 19 Apr 2023 20:21:10 +0200 Subject: [PATCH 1/3] DEF_OPTS --- run/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/run.sh b/run/run.sh index 8d07e3c..96b8a7a 100755 --- a/run/run.sh +++ b/run/run.sh @@ -54,10 +54,10 @@ if [ -z "${KVM_OPTS}" ]; then [ "$DEBUG" != "Y" ] && exit 88 fi +DEF_OPTS="-nographic -nodefaults" KVM_OPTS="-machine type=q35,usb=off${KVM_OPTS}" RAM_OPTS=$(echo "-m ${RAM_SIZE}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-smp ${CPU_CORES},sockets=1,cores=${CPU_CORES},threads=1" -DEF_OPTS="-nographic -nodefaults -overcommit mem-lock=off" EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0 -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0" ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${KVM_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS}" From 3e2248684059b9d62285647c7baf5aa8f5d01b98 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 19 Apr 2023 20:22:13 +0200 Subject: [PATCH 2/3] Wrong var --- run/disk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run/disk.sh b/run/disk.sh index 1e82b8a..3c95b80 100644 --- a/run/disk.sh +++ b/run/disk.sh @@ -42,7 +42,7 @@ if [ -f "${DATA}" ]; then if (( REQ > SPACE )); then echo "ERROR: Not enough free space to resize virtual disk to ${DISK_SIZE}." - echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATION=N." && exit 84 + echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATE=N." && exit 84 fi if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then @@ -85,7 +85,7 @@ if [ ! -f "${DATA}" ]; then if (( DATA_SIZE > SPACE )); then echo "ERROR: Not enough free space to create a virtual disk of ${DISK_SIZE}." - echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATION=N." && exit 86 + echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATE=N." && exit 86 fi if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then From 82fc1e7638c330e6a8616d2db18e2e34d82f6c38 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 19 Apr 2023 20:56:09 +0200 Subject: [PATCH 3/3] Allow to change disk parameters --- run/disk.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/run/disk.sh b/run/disk.sh index 3c95b80..26c1fea 100644 --- a/run/disk.sh +++ b/run/disk.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash set -eu +# Docker environment variabeles + +: ${DISK_IO:='native'} # I/O Mode +: ${DISK_ROTATION:='1'} # Rotation rate +: ${DISK_CACHE:='none'} # Caching mode + BOOT="$STORAGE/$BASE.boot.img" SYSTEM="$STORAGE/$BASE.system.img" @@ -127,11 +133,11 @@ fi DISK_OPTS="\ -device virtio-scsi-pci,id=hw-synoboot,bus=pcie.0,addr=0xa \ - -drive file=${BOOT},if=none,id=drive-synoboot,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on \ - -device scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,rotation_rate=1,bootindex=1 \ + -drive file=${BOOT},if=none,id=drive-synoboot,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=on,detect-zeroes=on \ + -device scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,rotation_rate=${DISK_ROTATION},bootindex=1 \ -device virtio-scsi-pci,id=hw-synosys,bus=pcie.0,addr=0xb \ - -drive file=${SYSTEM},if=none,id=drive-synosys,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on \ - -device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,rotation_rate=1,bootindex=2 \ + -drive file=${SYSTEM},if=none,id=drive-synosys,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=on,detect-zeroes=on \ + -device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,rotation_rate=${DISK_ROTATION},bootindex=2 \ -device virtio-scsi-pci,id=hw-userdata,bus=pcie.0,addr=0xc \ - -drive file=${DATA},if=none,id=drive-userdata,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on \ - -device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,rotation_rate=1,bootindex=3" + -drive file=${DATA},if=none,id=drive-userdata,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=on,detect-zeroes=on \ + -device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,rotation_rate=${DISK_ROTATION},bootindex=3"