Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation steps of kvdo + vdo on Debian 11(.4) #64

Open
tigerblue77 opened this issue Dec 4, 2022 · 5 comments
Open

Installation steps of kvdo + vdo on Debian 11(.4) #64

tigerblue77 opened this issue Dec 4, 2022 · 5 comments

Comments

@tigerblue77
Copy link

Hello everyone,

I create this clean new issue following a bug solved in previous one + clean version of Debian's installation script.
I wrote this little script to install kvdo + vdo on Debian 11(.4) (tested with 5.10.0-14-amd64 Linux kernel)

install_dependencies() {
    (( ${#} > 1 )) && {
        apt update && \
        apt install -y "$@"
    } || echo "No dependency to install"
}

clean_dependencies() {
    (( ${#} > 1 )) && {
        apt autoremove --purge -y "$@"
    } || echo "No dependency to remove"
}

clone_repo() {
    (( ${#} == 1 )) && {
        local TEMPORARY_DIRECTORY=$(mktemp -d "/tmp/${1/*\/}.XXX") && \
        git clone "$1" "${TEMPORARY_DIRECTORY}" && \
        cd "${TEMPORARY_DIRECTORY}" && \
        pwd -P
    }
}

# Usage: clean $WORK_DIRECTORY $DEPENDENCIES $OTHERS $...
clean() {
    (( ${#} >= 1 )) && {
        clean_dependencies "${*:2}" > /dev/null 2>&1 &
        rm -Rf "$1" &
        wait
    }
}

# First part : KVDO module
DEPENDENCIES="make linux-headers-$(uname -r)"
install_dependencies $DEPENDENCIES dkms > /dev/null 2>&1
KVDO_module_version_to_install="8.2.1.2.fixed"
KVDO_ARCHIVE_NAME="kvdo.tar.gz"
KVDO_ARCHIVE_PATH="/tmp/$KVDO_ARCHIVE_NAME"
KVDO_MODULE_PATH="/usr/src"
wget -O $KVDO_ARCHIVE_PATH "https://github.com/tigerblue77/kvdo/archive/refs/tags/$KVDO_module_version_to_install.tar.gz" && \
tar -xf $KVDO_ARCHIVE_PATH -C $KVDO_MODULE_PATH

echo "PACKAGE_NAME=\"kvdo\"
PACKAGE_VERSION=\"$KVDO_module_version_to_install\"
AUTOINSTALL=\"yes\"

BUILT_MODULE_NAME[0]=\"kvdo\"
BUILT_MODULE_LOCATION[0]=\"vdo\"
DEST_MODULE_LOCATION[0]=\"/kernel/drivers/block/\"
STRIP[0]=\"no\"" > "$KVDO_MODULE_PATH/kvdo-$KVDO_module_version_to_install/dkms.conf"
dkms add "kvdo/$KVDO_module_version_to_install"
dkms build "kvdo/$KVDO_module_version_to_install"
dkms install "kvdo/$KVDO_module_version_to_install"

clean $DEPENDENCIES $KVDO_ARCHIVE_PATH

# Second Part: VDO Module
DEPENDENCIES="git make gcc uuid-dev libz-dev libdevmapper-dev libblkid-dev"
install_dependencies $DEPENDENCIES > /dev/null 2>&1
WORK_DIRECTORY="$(clone_repo https://github.com/dm-vdo/vdo.git)"
(
    cd "${WORK_DIRECTORY}" && \
    make -j"$(nproc)" && \
    make -j"$(nproc)" install
) > vdo_build.log 2>&1
clean "${WORK_DIRECTORY}" $DEPENDENCIES

depmod --quick

VDO's part questions (second part) :
- Can anyone tell me if lines 32-34 are needed ?
- Don't hesitate to suggest any improvment !

  • Once improved, maybe we could add this script to repository's README.md ?

I tested this script with the following LVM volume creation script :

pvcreate /dev/sdb
vgcreate vgdo /dev/sdb
# I set the slab size to 8GB because my server will have between 20 to 60TB of usable space
lvcreate --type vdo --name vdolv --extents 100%VG --virtualsize 100G --config 'allocation/vdo_slab_size_mb=128' vgdo
mkfs.ext4 -E nodiscard /dev/vgdo/vdolv

# If you want your VDO volumes to mount successfully at next boot :
# 1. add necessary /etc/fstab entries
MOUNTPOINT="/mnt/vdolv"
echo "/dev/vgdo/vdolv   $MOUNTPOINT  ext4    defaults    0   0" >> /etc/fstab
# 2. Run the following command :
echo -e "\tevent_activation = 0" >> /etc/lvm/lvm.conf
# 3. Create mount point directory
mkdir $MOUNTPOINT

lvs
lsblk

# List errors :
journalctl -p 3 -xb

I wrote this script with help of those forum topics :

@basos9
Copy link

basos9 commented Feb 14, 2023

Hello,
I also modified it in order to use the repo https://github.com/dm-vdo/kvdo
And I am testing it on rasbian 11

# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"

# uname -r
5.15.84-v8+

# modinfo kvdo
filename:       /lib/modules/5.15.84-v8+/updates/dkms/kvdo.ko.xz
version:        8.2.1.3
license:        GPL
author:         Red Hat, Inc.
description:    device-mapper target for transparent deduplication
srcversion:     0C084846338C846253167E3
depends:        dm-mod,dm-bufio,lz4_compress
name:           kvdo
vermagic:       5.15.84-v8+ SMP preempt mod_unload modversions aarch64

install_dependencies() {
    (( ${#} > 1 )) && {
        apt update && \
        apt install -y "$@"
    } || echo "No dependency to install"
}

clean_dependencies() {
    (( ${#} > 1 )) && {
        apt autoremove --purge -y "$@"
    } || echo "No dependency to remove"
}

clone_repo() {
    (( ${#} == 1 )) && {
        local TEMPORARY_DIRECTORY=$(mktemp -d "/tmp/${1/*\/}.XXX") && \
        git clone "$1" "${TEMPORARY_DIRECTORY}" && \
        cd "${TEMPORARY_DIRECTORY}" && \
        pwd -P
    }
}

# Usage: clean $WORK_DIRECTORY $DEPENDENCIES $OTHERS $...
clean() {
    (( ${#} >= 1 )) && {
        clean_dependencies "${*:2}" > /dev/null 2>&1 &
        rm -Rf "$1" &
        wait
    }
}

set -x
# First part : KVDO module
DEPENDENCIES="make linux-headers-$(uname -r)"
install_dependencies $DEPENDENCIES dkms > /dev/null 2>&1
KVDO_ARCHIVE_NAME="kvdo"
KVDO_ARCHIVE_PATH="/tmp/$KVDO_ARCHIVE_NAME"
KVDO_MODULE_PATH="/usr/src"
(cd /tmp; git clone https://github.com/dm-vdo/kvdo.git;)
(cd $KVDO_ARCHIVE_PATH || { echo "kvdo repo not found!"; exit 3; }; git pull )
KVDO_module_version_to_install=`sed -rn '/VDO_VERSION/s/.* =| //gp' /tmp/kvdo/vdo/Makefile`
cp -a $KVDO_ARCHIVE_PATH $KVDO_MODULE_PATH/kvdo-$KVDO_module_version_to_install
(cd $KVDO_MODULE_PATH/kvdo-$KVDO_module_version_to_install && rm -rf .git)

echo "PACKAGE_NAME=\"kvdo\"
PACKAGE_VERSION=\"$KVDO_module_version_to_install\"
AUTOINSTALL=\"yes\"
BUILT_MODULE_NAME[0]=\"kvdo\"
BUILT_MODULE_LOCATION[0]=\"vdo\"
DEST_MODULE_LOCATION[0]=\"/kernel/drivers/block/\"
STRIP[0]=\"no\"" > "$KVDO_MODULE_PATH/kvdo-$KVDO_module_version_to_install/dkms.conf"

dkms add "kvdo/$KVDO_module_version_to_install"
dkms build "kvdo/$KVDO_module_version_to_install"
dkms install "kvdo/$KVDO_module_version_to_install"

clean $DEPENDENCIES $KVDO_ARCHIVE_PATH

# Second Part: VDO Module
DEPENDENCIES="git make gcc uuid-dev libz-dev libdevmapper-dev libblkid-dev"
install_dependencies $DEPENDENCIES > /dev/null 2>&1
WORK_DIRECTORY="$(clone_repo https://github.com/dm-vdo/vdo.git)"
(
    cd "${WORK_DIRECTORY}" && \
    make -j"$(nproc)" && \
    make -j"$(nproc)" install
) > vdo_build.log 2>&1
clean "${WORK_DIRECTORY}" $DEPENDENCIES

depmod --quick

@basos9
Copy link

basos9 commented Feb 14, 2023

Note that for the

KVDO_module_version_to_install="8.2.1.2.fixed"
wget -O $KVDO_ARCHIVE_PATH "https://github.com/tigerblue77/kvdo/archive/refs/tags/$KVDO_module_version_to_install.tar.gz"

The compilation broke and needed this patch

sed -r -i 's/BIO_MAX_PAGES/BIO_MAX_VECS/g' /var/lib/dkms/kvdo/8.2.1.2.fixed/source/vdo/vio.h

But the dm-vdo one worked unpatched.

@tigerblue77
Copy link
Author

tigerblue77 commented Feb 14, 2023

Hey @basos9, glad that my script helped you. I now use Ansible to do all of this waiting for KVDO to be included in Kernel.

The compilation broke and needed this patch

sed -r -i 's/BIO_MAX_PAGES/BIO_MAX_VECS/g' /var/lib/dkms/kvdo/8.2.1.2.fixed/source/vdo/vio.h

But the dm-vdo one worked unpatched.

That's normal, you're using Kernel >= 5.15 (5.15.84-v8+) and it's a fix because Debian stable release is still in 5.10.x

Except that, I don't see what your script adds to mine ? 🙂

@basos9
Copy link

basos9 commented Feb 14, 2023

I just changed the source repo for kvdo from

https://github.com/tigerblue77/kvdo/archive/refs/tags/...
to
https://github.com/dm-vdo/kvdo.git

I don't know what's the difference between the two, but the latter seemed more reasonable.

But the way I get theese warnings

Feb 14 11:27:40 x kernel: kvdo3:lvchange: Detected version mismatch between kernel module and tools kernel: 4, tool: 2
Feb 14 11:27:40 x kernel: kvdo3:lvchange: Please consider upgrading management tools to match kernel.               


# vdoformat --version                                                                            │
vdoformat version is: 8.2.0.2 

@tigerblue77
Copy link
Author

tigerblue77 commented Feb 14, 2023

I don't know what's the difference between the two

The difference is easy to see, go on my repository, then click on 8 commits ahead in the following banner :

This branch is 8 commits ahead, 1 commit behind dm-vdo:master.

Then if you scrool a bit, you'll be able to see all files differences. You can also have a look to commits title and to this PR.

but the latter seemed more reasonable.

In your case, I think yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants