I am testing cloud-init to mount EBS volume to /var/lib/docker in EC2. I
am running coreos-cloudinit manually, but I am not able to mount volume to
local file system.
I have created and attached volume /dev/xvdf in EC2 for my test instance.
My cloud config:
#cloud-config
coreos:
update:
reboot-strategy: "off"
units:
- name: var-lib-docker.mount
enable: true
content: |
[Unit]
Description=Mount EBS volume /dev/xvdf to /var/lib/docker
[Mount]
What=/dev/xvdf
Where=/var/lib/docker
Type=ext4
I am running the file as
/usr/bin/coreos-cloudinit --from-file docker.yaml
Result
~ # /usr/bin/coreos-cloudinit --from-file docker.yaml
2017/04/21 05:50:37 Checking availability of "local-file"
2017/04/21 05:50:37 Fetching user-data from datasource of type "local-file"
2017/04/21 05:50:37 Fetching meta-data from datasource of type "local-file"
2017/04/21 05:50:37 Parsing user-data as cloud-config
2017/04/21 05:50:37 Merging cloud-config from meta-data and user-data
2017/04/21 05:50:37 Writing file to "/etc/coreos/update.conf"
2017/04/21 05:50:37 Wrote file to "/etc/coreos/update.conf"
2017/04/21 05:50:37 Wrote file /etc/coreos/update.conf to filesystem
2017/04/21 05:50:37 Updated /etc/environment
2017/04/21 05:50:37 Writing unit "var-lib-docker.mount" to filesystem
2017/04/21 05:50:37 Writing file to
"/etc/systemd/system/var-lib-docker.mount"
2017/04/21 05:50:37 Wrote file to "/etc/systemd/system/var-lib-docker.mount"
2017/04/21 05:50:37 Wrote unit "var-lib-docker.mount"
2017/04/21 05:50:37 Enabling unit file "var-lib-docker.mount"
2017/04/21 05:50:37 Enabled unit "var-lib-docker.mount"
2017/04/21 05:50:37 Ensuring runtime unit file "etcd.service" is unmasked
2017/04/21 05:50:37 Ensuring runtime unit file "etcd2.service" is unmasked
2017/04/21 05:50:37 Ensuring runtime unit file "fleet.service" is unmasked
2017/04/21 05:50:37 Ensuring runtime unit file "locksmithd.service" is
unmasked
2017/04/21 05:50:37 Masking unit file "locksmithd.service"
2017/04/21 05:50:38 Calling unit command "stop" on "locksmithd.service"
2017/04/21 05:50:38 Result of "stop" on "locksmithd.service": done
~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 128G 0 disk
|-xvda6 202:6 0 128M 0 part /usr/share/oem
|-xvda4 202:4 0 1G 0 part
|-xvda2 202:2 0 2M 0 part
|-xvda9 202:9 0 125.7G 0 part /
|-xvda7 202:7 0 64M 0 part
|-xvda3 202:3 0 1G 0 part
| `-usr 254:0 0 1016M 1 crypt /usr
`-xvda1 202:1 0 128M 0 part /boot
xvdf 202:80 0 30G 0 disk
as you can see the /dev/xvdf is not getting mounted to /var/lib/docker.
Please help with correct cloud-init file or command.