Update haos-vm-v4.sh

changes for non thin provisioned disks
This commit is contained in:
tteckster 2022-12-05 17:35:28 -05:00 committed by GitHub
parent 9e1c5b15e0
commit 34da49ea02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -18,6 +18,7 @@ BFR="\\r\\033[K"
HOLD="-" HOLD="-"
CM="${GN}${CL}" CM="${GN}${CL}"
CROSS="${RD}${CL}" CROSS="${RD}${CL}"
THIN="discard=on,ssd=1,"
set -o errexit set -o errexit
set -o errtrace set -o errtrace
set -o nounset set -o nounset
@ -132,7 +133,7 @@ MACH=$(whiptail --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "
exitstatus=$? exitstatus=$?
if [ $MACH = q35 ]; then if [ $MACH = q35 ]; then
echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}"
FORMAT=",format=raw" FORMAT=""
MACHINE=" -machine q35" MACHINE=" -machine q35"
else else
echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}"
@ -254,15 +255,17 @@ unxz $FILE
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
case $STORAGE_TYPE in case $STORAGE_TYPE in
nfs|dir) nfs|dir)
DISK_EXT=".qcow2" DISK_EXT=".raw"
DISK_REF="$VMID/" DISK_REF="$VMID/"
DISK_IMPORT="-format qcow2" DISK_IMPORT="-format raw"
THIN=""
;; ;;
btrfs) btrfs)
DISK_EXT=".raw" DISK_EXT=".raw"
DISK_REF="$VMID/" DISK_REF="$VMID/"
DISK_FORMAT="subvol"
DISK_IMPORT="-format raw" DISK_IMPORT="-format raw"
FORMAT=",efitype=4m"
THIN=""
;; ;;
esac esac
for i in {0,1}; do for i in {0,1}; do
@ -278,7 +281,7 @@ pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null
qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null
qm set $VMID \ qm set $VMID \
-efidisk0 ${DISK0_REF}${FORMAT} \ -efidisk0 ${DISK0_REF}${FORMAT} \
-scsi0 ${DISK1_REF},discard=on,size=32G,ssd=1 \ -scsi0 ${DISK1_REF},${THIN}size=32G \
-boot order=scsi0 \ -boot order=scsi0 \
-description "# Home Assistant OS -description "# Home Assistant OS
### https://github.com/tteck/Proxmox ### https://github.com/tteck/Proxmox