docs icon indicating copy to clipboard operation
docs copied to clipboard

Docker storage instructions incomplete/incorrect

Open wintamute opened this issue 9 years ago • 1 comments

The instructions on how to add ephemeral storage to Docker are missing a critical piece of information which leads to incorrect behavior.

  - name: format-ephemeral.service
       command: start
       content: |
         [Unit]
         Description=Formats the ephemeral drive
         After=dev-xvdb.device
         Requires=dev-xvdb.device
         [Service]
         Type=oneshot
         RemainAfterExit=yes
         ExecStart=/usr/sbin/wipefs -f /dev/xvdb
         ExecStart=/usr/sbin/mkfs.ext4 -F /dev/xvdb

correctly formats the drive, but does so on every reboot which kinda defeats the purpose of ephemeral storage. Using the following works as intended (as suggested here)

 - name: format-ephemeral.service
       command: start
       content: |
         [Unit]
         Description=Formats the ephemeral drive
         After=dev-sdb.device
         Requires=dev-sdb.device
         ConditionPathExists=!/var/lib/format-done
         [Service]
         Type=oneshot
         RemainAfterExit=yes
         ExecStart=/usr/sbin/wipefs -f /dev/sdb
         ExecStart=/usr/sbin/mkfs.ext4 -F /dev/sdb
         ExecStartPost=/usr/bin/touch /var/lib/format-done

Using the also suggested option

ConditionFirstBoot=

might work too, but wasn't a solution for me since the disk was added after first booting. Not sure what the preferred solution to this would be, but at least it should be pointed out that with the current Unit file you'll loose everything after the next reboot.

wintamute avatar Jun 22 '16 09:06 wintamute

Update: PR created, once that gets merged or closed this will be closed.

pop avatar Jan 13 '17 23:01 pop