File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,6 +295,29 @@ assert_running_as_root() {
295295 fi
296296}
297297
298+ assert_enough_disk_space () {
299+ local SANDSTORM_CONF=" ${SANDSTORM_CONF:-/ opt/ sandstorm/ sandstorm.conf} "
300+ local SANDSTORM_DIR
301+ SANDSTORM_DIR=$( grep ' ^SANDSTORM_HOME=' " $SANDSTORM_CONF " | cut -d= -f2)
302+ SANDSTORM_DIR=" ${SANDSTORM_DIR:-/ opt/ sandstorm} "
303+
304+ # df -k reports available space in 1KB blocks; convert to GB for the comparison.
305+ local AVAILABLE_KB
306+ AVAILABLE_KB=$( df -k " $SANDSTORM_DIR " | awk ' NR==2 {print $4}' )
307+
308+ local REQUIRED_KB=$(( 1024 * 1024 )) # 1 GB in KB
309+
310+ if [ " $AVAILABLE_KB " -lt " $REQUIRED_KB " ]; then
311+ local AVAILABLE_MB=$(( AVAILABLE_KB / 1024 ))
312+ fail " E_INSUFFICIENT_DISK_SPACE" \
313+ " Insufficient disk space on the Sandstorm volume ($SANDSTORM_DIR ).
314+ Required: 1024 MB
315+ Available: ${AVAILABLE_MB} MB
316+
317+ Please free up disk space before running this migration."
318+ fi
319+ }
320+
298321assert_user_has_backed_up () {
299322 echo " "
300323 echo " *** IMPORTANT: DATABASE UPGRADE WARNING ***"
@@ -466,6 +489,7 @@ assert_on_terminal
466489assert_dependencies
467490assert_sandstorm_installed
468491assert_running_as_root
492+ assert_enough_disk_space
469493assert_user_has_backed_up
470494assert_valid_bundle_file
471495download_latest_bundle_if_needed
You can’t perform that action at this time.
0 commit comments