A Nomad dynamic host volume plugin for LVM thin provisioning.
make build
cp build/nomad-plugin-lvm /opt/nomad/host_volume_plugins/Reload the Nomad client (SIGHUP or systemctl reload nomad).
type = "host"
name = "myapp-data"
plugin_id = "nomad-plugin-lvm"
capacity_min = "1G"
capacity_max = "10G"
capability {
access_mode = "single-node-single-writer"
attachment_mode = "file-system"
}
parameters {
volume_group = "vg0"
thin_pool = "thinpool0"
}nomad volume create myapp-data.volume.hclCreates a thin LV with an ext4 filesystem.
Create a thin snapshot of an existing LV:
type = "host"
name = "myapp-snap"
plugin_id = "nomad-plugin-lvm"
parameters {
type = "snapshot"
source = "myapp-base"
volume_group = "vg0"
thin_pool = "thinpool0"
}The source LV must already exist in the same volume group.
All configuration is passed through the volume definition's parameters {} block:
| Parameter | Required | Default | Description |
|---|---|---|---|
volume_group |
yes | — | LVM volume group name |
thin_pool |
yes | — | Thin pool name |
type |
no | persistent |
persistent (new thin LV) or snapshot (COW clone) |
source |
snapshot | — | Source LV name (required when type = "snapshot") |
filesystem |
no | ext4 |
Filesystem for persistent volumes |
mode |
no | filesystem |
filesystem or block |
mount_dir |
no | /srv/nomad-volumes |
Volume mount directory |
bin_path |
no | /usr/sbin |
Directory containing LVM, mount, and mkfs binaries |
- Nomad 1.10+ with dynamic host volumes
- LVM2 tools (
lvcreate,lvremove,lvs,lvchange) - An existing LVM thin pool