Skip to content

bad user-data to configure data-drive. #2

Closed

Description

@pdion891

The user-data pushed by the driver as cloud-init config is not good.

user-data sent is

#!/bin/sh
mkfs -t ext4 /dev/xvdb
mkdir -p /var/lib/docker
mount -t ext4 /dev/xvdb /var/lib/docker

The data volume is not remounted automatically after a reboot, and on CoreOS, the volume is formated at each reboot, which is dangerous because coreos will reboot automatically after a channel upgrade.

Good cloud-init configuration for coreos, ubuntu and centos:
Tested on ubuntu16.04 and coreos:

#cloud-config
fs_setup:
   - label:  data
     filesystem: 'ext4'
     device: '/dev/xvdb'
mounts:
 - [ xvdb, /var/lib/docker, "ext4", "defaults", "0", "0" ]
coreos:
  units:
    - name: format-datavolume.service
      command: start
      content: |
        [Unit]
        Description=Formats the data volume
        After=dev-xvdb.device
        Requires=dev-xvdb.device
        ConditionPathExists=!/var/lib/docker.btrfs
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=/usr/sbin/mkfs.btrfs /dev/xvdb
        ExecStart=/usr/bin/mkdir /var/lib/docker.btrfs
    - name: var-lib-docker.mount
      command: start
      content: |
        [Unit]
        Description=Mount data volume to /var/lib/docker
        Requires=format-datavolume.service
        After=format-datavolume.service
        [Mount]
        What=/dev/xvdb
        Where=/var/lib/docker
        Type=btrfs
    - name: docker.service
      drop-ins:
        - name: 10-wait-docker.conf
          content: |
            [Unit]
            After=var-lib-docker.mount
            Requires=var-lib-docker.mount

Activity

  1. self-assigned this
    on Mar 10, 2017
  2. simongodard commented on Mar 10, 2017

    @simongodard
    Member

    Fixed by #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions