labunix's blog

labunixのラボUnix

vmfs-tool6をdebパッケージにして導入する。

■vmfs-tool6をdebパッケージにして導入する。
 以下はstretchでやった。今回はbuster用。

 ファイルシステムがVMFS-6のHDDをdebianでマウントしてみる(読み取り専用)
 https://labunix.hateblo.jp/entry/20190815/1565806092

$ lsb_release -d
Description:	Debian GNU/Linux 10 (buster)

■vmfs-toolsはVMFS-5用なので使わない。
 説明がVMFSじゃ分かりにくいのは変わっていない。

$ apt-cache show vmfs-tools | ./myscripts/lsec Desc
Description-en: Tools to access VMFS filesystems
 VMFS is a clustered filesystem designed to store virtual machine disks for
 VMware ESX or ESXi Server hosts. This set of tools allows to access these
 filesystems from some other non ESX/ESXi host for e.g. maintenance tasks.
 .
 Only read access is available at the moment, but write access is under
 works. Multiple extents are supported.
 .
 The VMFS can be accessed with a command line tool or mounted through a
 userspace filesystem (FUSE-based).
Description-md5: 0cdea504f6c5a9da0070eeda2f011352

■vmfs6-toolをgitでダウンロード

$ sudo apt-get install -y git
$ git clone https://github.com/weafon/vmfs6-tool.git

■「./configure」で不足する前提条件となるパッケージを導入する。

$ cd vmfs6-tool

$ ./configure 2>&1 | awk '$3 ~ /no/{print substr($NF,1,length($NF)-5)}'
pkg-config
asciidoc
xsltproc
docbook.xsl

$ ./configure 2>&1 | awk '$3 ~ /no/{print substr($NF,1,length($NF)-5)}' | xargs sudo apt-get install -y 

■前提条件となるパッケージの確認。

$ ./configure 2>&1 | awk '$3 ~ /...yes/{print substr($NF,1,length($NF)-6)}'
pkg-config
uuid
fuse
asciidoc
xsltproc
docbook.xsl
strndup
posix_memalign

$ ./configure 2>&1 | awk '$3 ~ /...yes/{print substr($NF,1,length($NF)-6)}' | \
    awk '{print "dpkg -l "$1}' | sh 2>&1 | \
    awk '{if($1 ~ /ii/){print "echo "$2,$3}else{if($1 ~ /dpkg-query/){print "apt-cache show "$2" | grep ^Package || echo "$2}}}' | sh
pkg-config 0.29-6
fuse 2.9.9-1+deb10u1
asciidoc 8.6.10-3
xsltproc 1.1.32-2.2~deb10u1
Package: docbook-xsl
Package: docbook-xsl-ns
Package: docbook-xsl-doc-html
Package: docbook-xsl-doc-pdf
Package: docbook-xsl-doc-text
Package: docbook-xsl-saxon
Package: ldp-docbook-xsl
E: パッケージが見つかりません
strndup
E: パッケージが見つかりません
posix_memalign

■strndup はstring(gcc)に、posix_memalignはglibcにある。

$ env LANG=C man posix_memalign | ~/myscripts/lsec "SEE ALSO|VERSIONS"
SEE ALSO
       brk(2), getpagesize(2), free(3), malloc(3)

VERSIONS
       The functions memalign(), valloc(), and pvalloc() have been available in all Linux libc libraries.

       The function aligned_alloc() was added to glibc in version 2.16.

       The function posix_memalign() is available since glibc 2.1.91.

$ env LANG=C man strndup | ~/myscripts/lsec "SEE ALSO"
SEE ALSO
       alloca(3), calloc(3), free(3), malloc(3), realloc(3), string(3), wcsdup(3)

$ sudo find / -type f -name "*.h" -exec grep "posix_memalign\|strndup" {} + 2>/dev/null | awk -F\: '{print $1 | "sort -uV"}'
/home/labunix/Android/Sdk/build-tools/30.0.1/renderscript/clang-include/mm_malloc.h
/home/labunix/vmfs6-tool/libvmfs/utils.h
/usr/include/stdlib.h
/usr/include/string.h
/usr/include/x86_64-linux-gnu/c++/8/bits/c++config.h
/usr/lib/gcc/x86_64-linux-gnu/8/include/mm_malloc.h

■*-devはyesとなっていても、個別に入れる。

$ ./configure
Checking for pkg-config...yes
Checking for uuid...yes
Checking for fuse...yes
Checking for asciidoc...yes
Checking for xsltproc...yes
Checking for docbook.xsl...yes
Checking for strndup...yes
Checking for dlopen in -ldl...yes
Checking for posix_memalign...yes
make: 'config.cache' は更新済みです.

$ w3m -dump "https://glandium.org/projects/vmfs-tools/" | ~/myscripts/lsec build
vmfs-tools has been verified to build on GNU/Linux, FreeBSD 7.2, Opensolaris
To get a full build of vmfs-tools, you need the following prerequisites:

  • gcc
  • GNU make
  • libuuid's development files
  • pkg-config
  • libfuse's development files
  • asciidoc
  • xsltproc
  • docbook-xsl

$ echo "uuid libfuse" | awk '{for(a=1;a<=NF;a++){print "apt-cache search ^"$a"-dev"}}' | sh
uuid-dev - Universally Unique ID library - headers and static libraries
libfuse-dev - ユーザ空間ファイルシステム (開発用)

$ sudo apt-get install -y uuid-dev libfuse-dev

■コンパイル、debパッケージ作成ツールを導入する。

$ sudo apt-get install -y build-essential dh-make debhelper devscripts checkinstall

■checkinstallだけは、buster-backportsにあるので、backportsを追加して再実行。

$ w3m -dump https://packages.debian.org/search?keywords=checkinstall | \
  ~/myscripts/lsec checkinstall | ~/myscripts/lsec -sep "" buster
  • buster-backports (admin): インストール追跡プログラム
    1.6.2+git20170426.d24a630-2~bpo10+1: amd64 arm64 armel armhf i386 mips
    mips64el mipsel ppc64el s390x

$ echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee /etc/apt/sources.list.d/checkinstall.list
deb http://deb.debian.org/debian buster-backports main

$ sudo apt-get update
$ sudo apt-get install -y checkinstall

■checkinstallの実行

$ pwd
/home/labunix/vmfs6-tool

$ sudo checkinstall

■「Version:」が「tool」になっていて数字で始まっていないので、
 以下の「[]」内にあるように修正。

$ grep -i ^version version 
VERSION := v0.0.0.846.84e0

このパッケージは以下の内容で構成されます: 

0 -  Maintainer: [ root@dummy-debian ]
1 -  Summary: [ Tools to access VMFS-6 filesystems ]
2 -  Name:    [ vmfs6-tool ]
3 -  Version: [ 0.0.0.846.84e0 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ vmfs6-tool ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Recommends: [  ]
12 - Suggests: [  ]
13 - Provides: [ vmfs6 ]
14 - Conflicts: [  ]
15 - Replaces: [  ]

変更するものの番号を入力してください。Enterで続行します: 

■出来上がったdebパッケージを確認。

$ ls *.deb
vmfs6-tool_0.0.0.846.84e0-1_amd64.deb

$ dpkg -l | awk '$1 ~ /ii/&&$2 ~ /vmfs6-tool/' | sed -e 's/   */,/g'
ii,vmfs6-tool,0.0.0.846.84e0-1,amd64,Tools to access VMFS-6 filesystems

■マウントする。

$ sudo mkdir /media/usb_datastore1/
$ sudo vmfs-fuse /dev/sdb1 /media/usb_datastore1/
VMFS version: 6

■アンマウントは普通に。

$ sudo umount /media/usb_datastore1