Debian

編譯 VDO 以在 Debian 上使用

  • April 25, 2022

我找不到任何適用於 Debian 的 vdo 軟體包,而且我自己編譯和執行該軟體的嘗試都失敗了。任何人都可以闡明如何編譯 vdo 以與 Debian 一起使用,因為這是 RHEL 在收購另一家公司後發布的軟體。

我目前的步驟是:

apt-get update -y
apt-get install -y git sudo
sudo apt-get upgrade -y
sudo apt-get install -y build-essential libdevmapper-dev libz-dev uuid-dev
git clone https://github.com/dm-vdo/vdo.git
make
make install
sudo apt install -t stretch-backports linux-headers-$(uname -r)
git clone https://github.com/dm-vdo/kvdo.git
make -C /usr/src/linux-headers-`uname -r` M=`pwd`
cp vdo/kvdo.ko /lib/modules/$(uname -r)
cp uds/uds.ko /lib/modules/$(uname -r)
depmod
modprobe kvdo
modprobe uds
systemctl start vdo

// error with
Starting VDO volume services...
Traceback (most recent call last):
 File "/usr/bin/vdo", line 46, in <module>
   from vdo.utils import Command

OP的問題不完整:錯誤消息的結尾包含解決此問題的重要線索不包括在內。在這裡(在 Debian buster 上。Debian 9 會改為搜尋python3.5):

# vdo status
Traceback (most recent call last):
 File "/usr/local/bin/vdo", line 46, in <module>
   from vdo.utils import Command
 File "/usr/local/lib/python3.7/dist-packages/vdo/utils/__init__.py", line 27, in <module>
   from .YAMLObject import YAMLObject
 File "/usr/local/lib/python3.7/dist-packages/vdo/utils/YAMLObject.py", line 33, in <module>
   import yaml
ModuleNotFoundError: No module named 'yaml'

所以python程式碼需要一個yaml模組。

# apt-cache search python3 yaml | grep yaml | head -5
python3-pretty-yaml - module to produce pretty and readable YAML-serialized data (Python 3)
python3-xstatic-js-yaml - JavaScript yaml implementation - XStatic support
python3-xstatic-json2yaml - converts json or simple javascript objects into a yaml - XStatic support
python3-yamlordereddictloader - loader and dump for PyYAML keeping keys order
python3-yaml - YAML parser and emitter for Python3

# apt-get install python3-yaml

$$ … $$

# vdo status
VDO status:
 Date: '2019-05-13 19:33:06+02:00'
 Node: somenode
Kernel module:
 Loaded: true
 Name: kvdo
 Version information:
   kvdo version: 6.2.0.293
Configuration:
 File: does not exist
 Last modified: not available
VDOs: {}

就是這樣。請注意,如果沒有進行任何配置,實際上什麼都不會啟動。您應該按照 Redhat 提供的說明進行操作:1.5。創建 VDO 卷

這是我跑的一個例子:

# vdo create --name=vdo-data --device=/dev/md0 --vdoLogicalSize=8T
Creating VDO vdo-data
Starting VDO vdo-data
Starting compression on VDO vdo-data
VDO instance 0 volume is ready at /dev/mapper/vdo-data

即使沒有完全安裝它,看一眼也能vdo.service提供足夠的資訊:

ExecStart=/usr/bin/vdo start --all --confFile /etc/vdoconf.yml

所以手動:

# vdo start --all --confFile /etc/vdoconf.yml
Starting VDO vdo-data
VDO instance 0 volume is ready at /dev/mapper/vdo-data

# ps -ef|grep vdo
root     11590     2  0 19:53 ?        00:00:00 [kvdo0:dedupeQ]
root     11593     2  0 19:53 ?        00:00:00 [kvdo0:journalQ]
root     11594     2  0 19:53 ?        00:00:00 [kvdo0:packerQ]
root     11595     2  0 19:53 ?        00:00:00 [kvdo0:logQ0]

$$ … $$

# vdo status
VDO status:
 Date: '2019-05-13 19:54:46+02:00'
 Node: somenode
Kernel module:
 Loaded: true
 Name: kvdo
 Version information:
   kvdo version: 6.2.0.293
Configuration:
 File: /etc/vdoconf.yml
 Last modified: '2019-05-13 19:53:35'
VDOs:
 vdo-data:
   Acknowledgement threads: 1
   Activate: enabled
   Bio rotation interval: 64
   Bio submission threads: 4
   Block map cache size: 128M
   Block map period: 16380
   Block size: 4096
   CPU-work threads: 2
   Compression: enabled
   Configured write policy: auto
   Deduplication: enabled
   Device mapper status: 0 17179869184 vdo /dev/md0 normal - online online 1151960 242161600
   Emulate 512 byte: disabled
   Hash zone threads: 1
   Index checkpoint frequency: 0

$$ … $$ 最後說明:要在核心 >= 4.20 上執行它,預設情況下需要核心中沒有可變參數函式,kvdo 需要更改。最簡單的就是忽略相應的警告,直到項目本身糾正了受影響的功能。那裡的其他 RH 員工可提供 2x2 行修補樹。

引用自:https://unix.stackexchange.com/questions/518549