minishift/minishift-centos-iso

Mounting swap is not handle in all conditions

Closed this issue · 1 comments

On the initial boot, in the function prepare_data_partition of handle_user_data, we turn swap on:

    swapon "${UNPARTITIONED_HD}2"

src

But after a reboot the following code will not run the function prepare_data_partition again:

# If there is a partition with `boot2docker-data` as its label we are dealing with
# an already bootstrapped docker-machine. Just make sure to mount data partition and to unpack
# userdata.tar. Remember, /home/docker is not persistent
BOOT2DOCKER_DATA=`blkid -o device -l -t LABEL=$LABEL`
if [ -n "$BOOT2DOCKER_DATA" ]; then
	mount_data_partition
	handle_user_data
	exit 0
fi

# Test for our magic string (it means that the disk was made by ./boot2docker init)
HEADER=`dd if=$UNPARTITIONED_HD bs=1 count=${#MAGIC} 2>/dev/null`
if [ "$HEADER" = "$MAGIC" ]; then
	# Read /userdata.tar with ssh keys and place it temporarily under /
	dd if=/dev/sda of=/userdata.tar bs=1 count=4096 2>/dev/null

    prepare_data_partion
    mount_data_partition
    handle_user_data
fi

src

This means we do not remount swap. The swapon should probably happen in a separate function.

Merged via pull request #97