DRBD ON LVM2 THIN PROVISIONING

tested on Slackware 14.2 and current

INTRO

We don’t need CLVM nor lvmlockd/sanlock/dlm because:

Dual-primary is only required temporarily during XEN migration. With it disabled, the replicated vdisk does not come up as primary by itself, and remains in secondary state unless manually told to.

INSTALL

either from source

slackpkg install autoconf expat libaio boost zstd gcc-g++

git clone https://github.com/jthornber/thin-provisioning-tools.git
cd thin-provisioning-tools/
autoconf
./configure
make clean
make -j8
make install

or as binary package

slackpkg install thin-provisioning-tools

check

which thin_check
thin_check -h

THIN LV SETUP

make partition type Linux LVM available and check its resulting size

#partprobe
#partx -u /dev/sda
pvcreate /dev/sdb
pvs

then proceed with a thin pool and an LV creation

vgcreate vdisks /dev/sdb
lvcreate -l 100%FREE --thin vdisks/thinpool

lvcreate -V 5G --thin vdisks/thinpool -n slack
ls -lF /dev/vdisks/slack

ARCHITECTURE

The design we’re attempting to PoC here is as such:

DRBD ON TOP OF IT

on both nodes

mv -i /etc/drbd.conf /etc/drbd.conf.dist
vi /etc/drbd.conf

global {
    usage-count yes;
    udev-always-use-vnr;
}

common {
    net {
        protocol C;
        fencing resource-only;
        allow-two-primaries yes;
    }
    disk {
        read-balancing when-congested-remote;
    }
}

resource res-data {
    device    /dev/drbd0;
    meta-disk internal;

    on node1 {
        disk      /dev/sda3;
        address   x.x.x.x:7700;
    }
    on node2 {
        disk      /dev/sda3;
        address   x.x.x.x:7700;
    }
}

resource res-slack {
    device    /dev/drbd1;
    meta-disk internal;

    on node1 {
        disk      /dev/vdisks/slack;
        address   x.x.x.x:7701;
    }
    on node2 {
        disk      /dev/vdisks/slack;
        address   x.x.x.x:7701;
    }
}

scp /etc/drbd.conf node2:/etc/drbd.conf

modprobe drbd
modprobe drbd_transport_tcp
drbdadm down all
#dd if=/dev/zero of=/dev/... bs=1M count=1
drbdadm create-md all
drbdadm up all

node1

drbdadm primary --force res-data
drbdadm primary --force res-slack

all nodes

drbdadm status
ls -lF /dev/sda4 /dev/vdisks/slack /dev/drbd1
fdisk -l /dev/sda4 /dev/vdisks/slack /dev/drbd1

–> 1 073 741 824 vs 1 073 672 192 bytes hence 69632 difference

vi /etc/rc.d/rc.local

/sbin/modprobe drbd
/sbin/modprobe drbd_transport_tcp
/bin/lsmod | grep drbd
#/usr/local/sbin/drbdadm up all
/etc/init.d/drbd start

vi /etc/rc.d/rc.local_shutdown

#/usr/local/sbin/drbdadm down all
/etc/init.d/drbd stop
/sbin/rmmod drbd_transport_tcp
/sbin/rmmod drbd

ACCEPTANCE

all nodes

/usr/local/sbin/drbdadm status

and check that the replicated volumes are brought up at startup

reboot

ADDITIONAL NOTES

start from scratch

vgchange -an vdisks
dd if=/dev/zero of=/dev/sda2 bs=1M count=1

TODO

RESOURCES

thin

5.4.4. Creating Thinly-Provisioned Logical Volumes https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/thinly_provisioned_volume_creation

How to setup thin Provisioned Logical Volumes in CentOS 7 / RHEL 7 https://www.linuxtechi.com/thin-provisioned-logical-volumes-centos-7-rhel-7/

Thin Provisioning in LVM2 https://www.theurbanpenguin.com/thin-provisioning-lvm2/

Setup Thin Provisioning Volumes in Logical Volume Management (LVM) – Part IV https://www.tecmint.com/setup-thin-provisioning-volumes-in-lvm/

lockd

[linux-lvm] lvmlockd: how to convert lock_type from sanlock to dlm? https://www.redhat.com/archives/linux-lvm/2017-November/msg00018.html https://linux-lvm.redhat.narkive.com/wRZahcsN/lvmlockd-how-to-convert-lock-type-from-sanlock-to-dlm

[linux-lvm] The benefits of lvmlockd over clvmd? https://www.redhat.com/archives/linux-lvm/2018-January/msg00018.html

PVE 6.x Cluster Setup of shared LVM/LV with MSA2040 SAS [partial howto] https://forum.proxmox.com/threads/pve-6-x-cluster-setup-of-shared-lvm-lv-with-msa2040-sas-partial-howto.57536/

clvm

2.4. The Clustered Logical Volume Manager (CLVM) https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lvm_cluster_overview


HOME | GUIDES | BENCHMARKS | html