Skip to content

Instantly share code, notes, and snippets.

@gabibeyer
Last active February 27, 2019 21:24
Show Gist options
  • Save gabibeyer/58dbc07df1f6eee91ca5023a5cb27966 to your computer and use it in GitHub Desktop.
Save gabibeyer/58dbc07df1f6eee91ca5023a5cb27966 to your computer and use it in GitHub Desktop.

lvm-snapshotter

Getting Started

This document sets up an lvm-snapshotter that listens on a specified socket. It assumes that you already have a volume group, and thin logical volume set up, if not some example commands are provided below.

A very beginner guide to setting up a ccloudvm instance with sparse files in replace of disks can be found here: <>

Prerequisites

  • thin-provisioning-tools
  • golang version 1.11 +
# for ubuntu
apt-get install thin-provisioning-tools

if volume group (vg) and logical volume pool (lv) already created, skip these steps

a volume group - the requirements are: #TODO: note minimum requirements

$ vgcreate vgthin /dev/vdc
  Physical volume "/dev/vdc" successfully created.
  Volume group "vgthin" successfully created

a thin logical volume - the requirements are: #TODO: note minimum requirements

$ lvcreate --thinpool lvthinpool -l 90%FREE vgthin
  Using default stripesize 64.00 KiB.
  Logical volume lvthinpool created in Volume group vgthin.

Execute snapshotter

go version 1.11 go mod download go get -u all go build

run as root

sudo ./lvm-snapshotter /var/run/lvmsnapshotter.sock vgthin lvthinpool lvm-snapshotter

Containerd config file

When running with containerd ctr, a config.toml is required for the plugin

vi /etc/containerd/config.toml

[proxy_plugins]
  [proxy_plugins.lvmsnapshotter]
    type = "snapshot"
    address = "/var/run/lvmsnapshotter.sock"

<gnbeyer_mobl> sudo ctr images pull --snapshotter=lvmsnapshotter docker.io/library/busybox:latest
<gnbeyer_mobl> sudo lvs



## Debugging
  Errors and possible fixes:
  ### prerequisites not met

Running command lvcreate with args: [--virtualsize 10G --name contd-metadata-holder --thin vgthin/lvthinpool] Unable to create the metadata volume error: Unable to create volume: exit status 5

more detailed error description:

Using default stripesize 64.00 KiB. /usr/sbin/thin_check: execvp failed: No such file or directory Check of pool vgthin/lvthinpool failed (status:2). Manual repair required! Aborting. Failed to locally activate thin pool vgthin/lvthinpool.

FIX: Need to install thin-provisioning-tools

$ apt-get install thin-provisioning-tools

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