Skip to content

Commit 2ae2052

Browse files
committed
[CTM-19] Move disk resize before starting the server
1 parent 0903403 commit 2ae2052

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

http/src/main/resources/init-resources/gce-init.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ for Disk in "${AllsdDisks[@]}"; do
243243
done
244244
DISK_DEVICE_ID=${FreesdDisks}
245245

246+
# Resize persistent disk if needed.
247+
# Must be done before trying to start the servers, otherwise it will fail to start if the disk is full.
248+
echo "Resizing persistent disk attached to runtime $GOOGLE_PROJECT / $CLUSTER_NAME if disk size changed..."
249+
resize2fs ${DISK_DEVICE_ID}
250+
251+
246252
## Only format disk is it hasn't already been formatted
247253
if [ "$IS_GCE_FORMATTED" == "false" ] ; then
248254
# It's likely that the persistent disk was previously mounted on another VM and wasn't properly unmounted
@@ -626,11 +632,6 @@ RSTUDIO_USER_HOME=$RSTUDIO_USER_HOME" >> /usr/local/lib/R/etc/Renviron.site'
626632
retry 3 docker exec -d ${RSTUDIO_SERVER_NAME} /init
627633
fi
628634

629-
# Resize persistent disk if needed.
630-
echo "Resizing persistent disk attached to runtime $GOOGLE_PROJECT / $CLUSTER_NAME if disk size changed..."
631-
resize2fs ${DISK_DEVICE_ID}
632-
633-
634635
# Remove any unneeded cached images to save disk space.
635636
# Do this asynchronously so it doesn't hold up cluster creation
636637
log 'Pruning docker images...'

0 commit comments

Comments
 (0)