Skip to content

Commit e73b0c8

Browse files
committed
Stop printing the VM ID twice, and grow the root on nocloud images
vm_select_storage announces the VM ID itself, and 20 scripts announced it again right after -- the converter kept the line when it replaced the inline storage block with the core call. The eight scripts that can run without cloud-init now expand the root partition offline before import. Without that, a 15G disk gave a 2.8G root: qm resize grows the block device, and only cloud-init's growpart grows what is inside.
1 parent b6a0fc6 commit e73b0c8

20 files changed

Lines changed: 56 additions & 20 deletions

‎vm/allstarlink-vm.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ vm_start_script "Use Default Settings?" 10 58
9090
post_to_api_vm
9191

9292
vm_select_storage "$HN"
93-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
9493
msg_info "Retrieving the URL for the Debian 12 Qcow2 Disk Image"
9594
URL="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-$(dpkg --print-architecture).qcow2"
9695
sleep 2
@@ -100,6 +99,13 @@ echo -en "\e[1A\e[0K"
10099
FILE=$(basename $URL)
101100
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
102101

102+
# qm resize only grows the block device. Without cloud-init nothing grows the
103+
# guest partition, so expand it offline first.
104+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
105+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
106+
vm_expand_image "$FILE" "$DISK_SIZE" || true
107+
fi
108+
103109
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
104110
case $STORAGE_TYPE in
105111
nfs | dir)

‎vm/almalinux-10-vm.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ vm_start_script "Use Default Settings?" 10 58
9595
post_to_api_vm
9696

9797
vm_select_storage "$HN"
98-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
9998

10099
# ==============================================================================
101100
# PREREQUISITES

‎vm/app-deployer-vm.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ function advanced_settings() {
135135
# ==============================================================================
136136
select_storage() {
137137
vm_select_storage "$HN"
138-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
139138

140139
# Detect storage type for disk format
141140
STORAGE_TYPE=$(pvesm status -storage "$STORAGE" | awk 'NR>1 {print $2}')

‎vm/archlinux-vm.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ vm_start_script "Use Default Settings?" 10 58
9292
post_to_api_vm
9393

9494
vm_select_storage "$HN"
95-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
9695
msg_info "Retrieving the URL for the Arch Linux .iso File"
9796
URL=https://geo.mirror.pkgbuild.com/iso/latest/archlinux-x86_64.iso
9897
sleep 2

‎vm/debian-13-vm.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ vm_start_script "Use Default Settings?" 10 58
108108
post_to_api_vm
109109

110110
vm_select_storage "$HN"
111-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
112111

113112
# ==============================================================================
114113
# PREREQUISITES
@@ -177,6 +176,13 @@ fi
177176

178177
msg_ok "Customized image"
179178

179+
# qm resize only grows the block device. Without cloud-init nothing grows the
180+
# guest partition, so expand it offline first.
181+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
182+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
183+
vm_expand_image "$WORK_FILE" "$DISK_SIZE" || true
184+
fi
185+
180186
STORAGE_TYPE=$(pvesm status -storage "$STORAGE" | awk 'NR>1 {print $2}')
181187
case $STORAGE_TYPE in
182188
nfs | dir)

‎vm/debian-vm-test-helper.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ vm_start_script "Use Default Settings?" 10 58
8787
post_to_api_vm
8888

8989
vm_select_storage "$HN"
90-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
9190
msg_info "Retrieving the URL for the Debian 12 Qcow2 Disk Image"
9291
URL=https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2
9392
sleep 2
@@ -97,6 +96,13 @@ echo -en "\e[1A\e[0K"
9796
FILE=$(basename $URL)
9897
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
9998

99+
# qm resize only grows the block device. Without cloud-init nothing grows the
100+
# guest partition, so expand it offline first.
101+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
102+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
103+
vm_expand_image "$FILE" "$DISK_SIZE" || true
104+
fi
105+
100106
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
101107
case $STORAGE_TYPE in
102108
nfs | dir)

‎vm/debian-vm.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ vm_start_script "Use Default Settings?" 10 58
106106
post_to_api_vm
107107

108108
vm_select_storage "$HN"
109-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
110109
msg_info "Retrieving the URL for the Debian 12 Qcow2 Disk Image"
111110
if [ "$CLOUD_INIT" == "yes" ]; then
112111
URL=https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
@@ -120,6 +119,13 @@ echo -en "\e[1A\e[0K"
120119
FILE=$(basename $URL)
121120
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
122121

122+
# qm resize only grows the block device. Without cloud-init nothing grows the
123+
# guest partition, so expand it offline first.
124+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
125+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
126+
vm_expand_image "$FILE" "$DISK_SIZE" || true
127+
fi
128+
123129
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
124130
case $STORAGE_TYPE in
125131
nfs | dir)

‎vm/docker-vm-debug.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ vm_start_script "Use Default Settings?" 10 58
213213
post_to_api_vm
214214

215215
vm_select_storage "$HN"
216-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
217216

218217
if ! command -v virt-customize; then
219218
msg_info "Installing Pre-Requisite libguestfs-tools onto Host"
@@ -233,6 +232,13 @@ echo -en "\e[1A\e[0K"
233232
FILE=$(basename $URL)
234233
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
235234

235+
# qm resize only grows the block device. Without cloud-init nothing grows the
236+
# guest partition, so expand it offline first.
237+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
238+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
239+
vm_expand_image "$FILE" "$DISK_SIZE" || true
240+
fi
241+
236242
STORAGE_TYPE=$(pvesm status -storage "$STORAGE" | awk 'NR>1 {print $2}')
237243
case $STORAGE_TYPE in
238244
nfs | dir)

‎vm/docker-vm.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ post_to_api_vm
207207
# STORAGE SELECTION
208208
# ==============================================================================
209209
vm_select_storage "$HN"
210-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
211210

212211
# ==============================================================================
213212
# PREREQUISITES
@@ -241,6 +240,13 @@ fi
241240
# ==============================================================================
242241
# STORAGE TYPE DETECTION
243242
# ==============================================================================
243+
# qm resize only grows the block device. Without cloud-init nothing grows the
244+
# guest partition, so expand it offline first.
245+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
246+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
247+
vm_expand_image "$WORK_FILE" "$DISK_SIZE" || true
248+
fi
249+
244250
STORAGE_TYPE=$(pvesm status -storage "$STORAGE" | awk 'NR>1 {print $2}')
245251
case $STORAGE_TYPE in
246252
nfs | dir)

‎vm/k3s-vm.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ vm_start_script "Use Default Settings?" 10 58
209209
post_to_api_vm
210210

211211
vm_select_storage "$HN"
212-
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
213212
msg_info "Retrieving the URL for the ${OS_DISPLAY} image"
214213
URL=$(get_image_url)
215214
sleep 2
@@ -219,6 +218,13 @@ echo -en "\e[1A\e[0K"
219218
FILE=$(basename $URL)
220219
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
221220

221+
# qm resize only grows the block device. Without cloud-init nothing grows the
222+
# guest partition, so expand it offline first.
223+
if [ "${CLOUD_INIT:-no}" != "yes" ]; then
224+
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
225+
vm_expand_image "$FILE" "$DISK_SIZE" || true
226+
fi
227+
222228
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
223229
case $STORAGE_TYPE in
224230
nfs | dir)

0 commit comments

Comments
 (0)