hi, I’m looking to get started on Digitalocean with a docker vm. Now, the currently recommended way to run Docker is through direct-lvm. This pretty much means creating a volume and doing
lvcreate --wipesignatures y -n data direct-lvm -l 95%VG
lvcreate --wipesignatures y -n metadata direct-lvm -l 5%VG
is this viable on Digitalocean ?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Using
direct-lvm
requires a free block device. DigitalOcean Droplets are setup with a single partition by default which makes this slightly difficult. Though with the addition of block storage (currently in beta), it becomes much easier.For example, booting up a new 16.04 Droplet with Docker installed and a block storage volume attached, we can see the free device at
sda
as well as the loopback device created by Docker’s defaults:For all the information setting up direct-lvm mode for production see the Docker documentation. Though, here’s a quick run through. First we will stop Docker and then create a new volume and thin pool.
Now edit the file
/etc/lvm/profile/docker-thinpool.profile
to configure auto-extending of the thin pool:Next, apply the change:
Then, we will configure Docker itself to use the new device. This can be done with command line arguments when starting Docker, but with systemd it is simpler to edit
/etc/docker/daemon.json
to include:Finally, let’s restart Docker:
Now that we’re done, you can see that the loopback device is gone and
sda
has been configured for LVM: