minishift / minishift-centos-iso

CentOS based ISO as an alternative for boot2docker ISO
GNU Lesser General Public License v3.0
40 stars 33 forks source link

Mounting swap is not handle in all conditions #96

Closed gbraad closed 7 years ago

gbraad commented 7 years ago

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.

hferentschik commented 7 years ago

Merged via pull request #97