CentOS7.5にZFS on Linux を入れる

参考資料
ゼロから CentOS 7 をインストールし ZFS で RAIDZ を使ってみた – Lunasalt.com http://lunasalt.com/?p=5015
RHEL and CentOS · zfsonlinux/zfs Wiki · GitHub https://github.com/zfsonlinux/zfs/wiki/RHEL-and-CentOS

環境

# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)

リポジトリの追加

# yum install http://download.zfsonlinux.org/epel/zfs-release.el7_5.noarch.rpm
Loaded plugins: fastestmirror
zfs-release.el7_5.noarch.rpm                                                                                                | 5.3 kB  00:00:00
Examining /var/tmp/yum-root-BhqdhO/zfs-release.el7_5.noarch.rpm: zfs-release-1-5.el7.centos.noarch
Marking /var/tmp/yum-root-BhqdhO/zfs-release.el7_5.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package zfs-release.noarch 0:1-5.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================
 Package                         Arch                       Version                            Repository                                     Size
===================================================================================================================================================
Installing:
 zfs-release                     noarch                     1-5.el7.centos                     /zfs-release.el7_5.noarch                     2.9 k

Transaction Summary
===================================================================================================================================================
Install  1 Package

Total size: 2.9 k
Installed size: 2.9 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : zfs-release-1-5.el7.centos.noarch                                                                                               1/1
  Verifying  : zfs-release-1-5.el7.centos.noarch                                                                                               1/1

Installed:
  zfs-release.noarch 0:1-5.el7.centos

Complete!
# yum install zfs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
base                                                                                                                        | 3.6 kB  00:00:00
extras                                                                                                                      | 3.4 kB  00:00:00
updates                                                                                                                     | 3.4 kB  00:00:00
zfs                                                                                                                         | 2.9 kB  00:00:00
(1/5): base/7/x86_64/group_gz                                                                                               | 166 kB  00:00:00
(2/5): extras/7/x86_64/primary_db                                                                                           | 149 kB  00:00:00
(3/5): updates/7/x86_64/primary_db                                                                                          | 2.7 MB  00:00:00
(4/5): base/7/x86_64/primary_db                                                                                             | 5.9 MB  00:00:00
(5/5): zfs/x86_64/primary_db                                                                                                |  12 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package zfs.x86_64 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: zfs-kmod = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: spl = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzpool2 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzfs2 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libuutil1 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libnvpair1 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: sysstat for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzpool.so.2()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzfs_core.so.1()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzfs.so.2()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libuutil.so.1()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libnvpair.so.1()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Running transaction check
---> Package libnvpair1.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package libuutil1.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package libzfs2.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package libzpool2.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package spl.x86_64 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: spl-kmod = 0.7.9 for package: spl-0.7.9-1.el7_5.x86_64
---> Package sysstat.x86_64 0:10.1.5-13.el7 will be installed
--> Processing Dependency: libsensors.so.4()(64bit) for package: sysstat-10.1.5-13.el7.x86_64
---> Package zfs-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.3 for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Processing Dependency: kernel-devel for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Processing Dependency: gcc for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
---> Package kernel-devel.x86_64 0:3.10.0-862.3.3.el7 will be installed
---> Package lm_sensors-libs.x86_64 0:3.4.0-4.20160601gitf9185e5.el7 will be installed
---> Package spl-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.2 for package: spl-dkms-0.7.9-1.el7_5.noarch
---> Package zfs-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.3 for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be installed
---> Package glibc-devel.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-222.el7 for package: glibc-devel-2.17-222.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-222.el7.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
---> Package spl-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.2 for package: spl-dkms-0.7.9-1.el7_5.noarch
---> Package zfs-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.3 for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-222.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-222.el7.x86_64
---> Package spl-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.2 for package: spl-dkms-0.7.9-1.el7_5.noarch
---> Package zfs-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.3 for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Running transaction check
---> Package kernel-headers.x86_64 0:3.10.0-862.3.3.el7 will be installed
---> Package spl-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.2 for package: spl-dkms-0.7.9-1.el7_5.noarch
---> Package zfs-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.3 for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Finished Dependency Resolution
Error: Package: spl-dkms-0.7.9-1.el7_5.noarch (zfs)
           Requires: dkms >= 2.2.0.2
Error: Package: zfs-dkms-0.7.9-1.el7_5.noarch (zfs)
           Requires: dkms >= 2.2.0.3
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

できない

EPEL追加する

# yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
base                                                                                                                        | 3.6 kB  00:00:00
extras                                                                                                                      | 3.4 kB  00:00:00
updates                                                                                                                     | 3.4 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================
 Package                                 Arch                              Version                         Repository                         Size
===================================================================================================================================================
Installing:
 epel-release                            noarch                            7-11                            extras                             15 k

Transaction Summary
===================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                |  15 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                        1/1
  Verifying  : epel-release-7-11.noarch                                                                                                        1/1

Installed:
  epel-release.noarch 0:7-11

Complete!


# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/epel.repo
# yum --enablerepo=epel install zfs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.dmmlabs.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package zfs.x86_64 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: zfs-kmod = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: spl = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzpool2 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzfs2 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libuutil1 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libnvpair1 = 0.7.9 for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: sysstat for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzpool.so.2()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzfs_core.so.1()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libzfs.so.2()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libuutil.so.1()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Processing Dependency: libnvpair.so.1()(64bit) for package: zfs-0.7.9-1.el7_5.x86_64
--> Running transaction check
---> Package libnvpair1.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package libuutil1.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package libzfs2.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package libzpool2.x86_64 0:0.7.9-1.el7_5 will be installed
---> Package spl.x86_64 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: spl-kmod = 0.7.9 for package: spl-0.7.9-1.el7_5.x86_64
---> Package sysstat.x86_64 0:10.1.5-13.el7 will be installed
--> Processing Dependency: libsensors.so.4()(64bit) for package: sysstat-10.1.5-13.el7.x86_64
---> Package zfs-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Processing Dependency: dkms >= 2.2.0.3 for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Processing Dependency: kernel-devel for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Processing Dependency: gcc for package: zfs-dkms-0.7.9-1.el7_5.noarch
--> Running transaction check
---> Package dkms.noarch 0:2.6.1-1.el7 will be installed
--> Processing Dependency: elfutils-libelf-devel for package: dkms-2.6.1-1.el7.noarch
---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
---> Package kernel-devel.x86_64 0:3.10.0-862.3.3.el7 will be installed
---> Package lm_sensors-libs.x86_64 0:3.4.0-4.20160601gitf9185e5.el7 will be installed
---> Package spl-dkms.noarch 0:0.7.9-1.el7_5 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be installed
---> Package elfutils-libelf-devel.x86_64 0:0.170-4.el7 will be installed
--> Processing Dependency: pkgconfig(zlib) for package: elfutils-libelf-devel-0.170-4.el7.x86_64
---> Package glibc-devel.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-222.el7 for package: glibc-devel-2.17-222.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-222.el7.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-222.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-222.el7.x86_64
---> Package zlib-devel.x86_64 0:1.2.7-17.el7 will be installed
--> Running transaction check
---> Package kernel-headers.x86_64 0:3.10.0-862.3.3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================
 Package                                 Arch                     Version                                          Repository                 Size
===================================================================================================================================================
Installing:
 zfs                                     x86_64                   0.7.9-1.el7_5                                    zfs                       413 k
Installing for dependencies:
 cpp                                     x86_64                   4.8.5-28.el7_5.1                                 updates                   5.9 M
 dkms                                    noarch                   2.6.1-1.el7                                      epel                       75 k
 elfutils-libelf-devel                   x86_64                   0.170-4.el7                                      base                       38 k
 gcc                                     x86_64                   4.8.5-28.el7_5.1                                 updates                    16 M
 glibc-devel                             x86_64                   2.17-222.el7                                     base                      1.1 M
 glibc-headers                           x86_64                   2.17-222.el7                                     base                      678 k
 kernel-devel                            x86_64                   3.10.0-862.3.3.el7                               updates                    16 M
 kernel-headers                          x86_64                   3.10.0-862.3.3.el7                               updates                   7.1 M
 libmpc                                  x86_64                   1.0.1-3.el7                                      base                       51 k
 libnvpair1                              x86_64                   0.7.9-1.el7_5                                    zfs                        30 k
 libuutil1                               x86_64                   0.7.9-1.el7_5                                    zfs                        35 k
 libzfs2                                 x86_64                   0.7.9-1.el7_5                                    zfs                       130 k
 libzpool2                               x86_64                   0.7.9-1.el7_5                                    zfs                       591 k
 lm_sensors-libs                         x86_64                   3.4.0-4.20160601gitf9185e5.el7                   base                       41 k
 mpfr                                    x86_64                   3.1.1-4.el7                                      base                      203 k
 spl                                     x86_64                   0.7.9-1.el7_5                                    zfs                        29 k
 spl-dkms                                noarch                   0.7.9-1.el7_5                                    zfs                       456 k
 sysstat                                 x86_64                   10.1.5-13.el7                                    base                      310 k
 zfs-dkms                                noarch                   0.7.9-1.el7_5                                    zfs                       4.9 M
 zlib-devel                              x86_64                   1.2.7-17.el7                                     base                       50 k

Transaction Summary
===================================================================================================================================================
Install  1 Package (+20 Dependent packages)

Total download size: 54 M
Installed size: 128 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/21): elfutils-libelf-devel-0.170-4.el7.x86_64.rpm                                                                        |  38 kB  00:00:00
warning: /var/cache/yum/x86_64/7/epel/packages/dkms-2.6.1-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for dkms-2.6.1-1.el7.noarch.rpm is not installed
(2/21): dkms-2.6.1-1.el7.noarch.rpm                                                                                         |  75 kB  00:00:00
(3/21): glibc-headers-2.17-222.el7.x86_64.rpm                                                                               | 678 kB  00:00:00
(4/21): glibc-devel-2.17-222.el7.x86_64.rpm                                                                                 | 1.1 MB  00:00:00
(5/21): cpp-4.8.5-28.el7_5.1.x86_64.rpm                                                                                     | 5.9 MB  00:00:00
(6/21): libmpc-1.0.1-3.el7.x86_64.rpm                                                                                       |  51 kB  00:00:00
(7/21): kernel-headers-3.10.0-862.3.3.el7.x86_64.rpm                                                                        | 7.1 MB  00:00:00
(8/21): gcc-4.8.5-28.el7_5.1.x86_64.rpm                                                                                     |  16 MB  00:00:00
(9/21): libnvpair1-0.7.9-1.el7_5.x86_64.rpm                                                                                 |  30 kB  00:00:00
(10/21): libuutil1-0.7.9-1.el7_5.x86_64.rpm                                                                                 |  35 kB  00:00:00
(11/21): lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64.rpm                                                          |  41 kB  00:00:00
(12/21): mpfr-3.1.1-4.el7.x86_64.rpm                                                                                        | 203 kB  00:00:00
(13/21): kernel-devel-3.10.0-862.3.3.el7.x86_64.rpm                                                                         |  16 MB  00:00:01
(14/21): libzfs2-0.7.9-1.el7_5.x86_64.rpm                                                                                   | 130 kB  00:00:00
(15/21): spl-0.7.9-1.el7_5.x86_64.rpm                                                                                       |  29 kB  00:00:00
(16/21): sysstat-10.1.5-13.el7.x86_64.rpm                                                                                   | 310 kB  00:00:00
(17/21): libzpool2-0.7.9-1.el7_5.x86_64.rpm                                                                                 | 591 kB  00:00:01
(18/21): zfs-0.7.9-1.el7_5.x86_64.rpm                                                                                       | 413 kB  00:00:00
(19/21): zlib-devel-1.2.7-17.el7.x86_64.rpm                                                                                 |  50 kB  00:00:00
(20/21): spl-dkms-0.7.9-1.el7_5.noarch.rpm                                                                                  | 456 kB  00:00:01
(21/21): zfs-dkms-0.7.9-1.el7_5.noarch.rpm                                                                                  | 4.9 MB  00:00:01
---------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                               12 MB/s |  54 MB  00:00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libuutil1-0.7.9-1.el7_5.x86_64                                                                                                 1/21
  Installing : libnvpair1-0.7.9-1.el7_5.x86_64                                                                                                2/21
  Installing : mpfr-3.1.1-4.el7.x86_64                                                                                                        3/21
  Installing : kernel-devel-3.10.0-862.3.3.el7.x86_64                                                                                         4/21
  Installing : libmpc-1.0.1-3.el7.x86_64                                                                                                      5/21
  Installing : libzpool2-0.7.9-1.el7_5.x86_64                                                                                                 6/21
  Installing : libzfs2-0.7.9-1.el7_5.x86_64                                                                                                   7/21
  Installing : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                    8/21
  Installing : lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64                                                                          9/21
  Installing : sysstat-10.1.5-13.el7.x86_64                                                                                                  10/21
  Installing : kernel-headers-3.10.0-862.3.3.el7.x86_64                                                                                      11/21
  Installing : glibc-headers-2.17-222.el7.x86_64                                                                                             12/21
  Installing : glibc-devel-2.17-222.el7.x86_64                                                                                               13/21
  Installing : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                   14/21
  Installing : zlib-devel-1.2.7-17.el7.x86_64                                                                                                15/21
  Installing : elfutils-libelf-devel-0.170-4.el7.x86_64                                                                                      16/21
  Installing : dkms-2.6.1-1.el7.noarch                                                                                                       17/21
  Installing : spl-dkms-0.7.9-1.el7_5.noarch                                                                                                 18/21
Loading new spl-0.7.9 DKMS files...
Building for 3.10.0-693.el7.x86_64
Module build for kernel 3.10.0-693.el7.x86_64 was skipped since the
kernel headers for this kernel does not seem to be installed.
  Installing : spl-0.7.9-1.el7_5.x86_64                                                                                                      19/21
  Installing : zfs-dkms-0.7.9-1.el7_5.noarch                                                                                                 20/21
Loading new zfs-0.7.9 DKMS files...
Building for 3.10.0-693.el7.x86_64
Module build for kernel 3.10.0-693.el7.x86_64 was skipped since the
kernel headers for this kernel does not seem to be installed.
  Installing : zfs-0.7.9-1.el7_5.x86_64                                                                                                      21/21
  Verifying  : kernel-devel-3.10.0-862.3.3.el7.x86_64                                                                                         1/21
  Verifying  : spl-dkms-0.7.9-1.el7_5.noarch                                                                                                  2/21
  Verifying  : zlib-devel-1.2.7-17.el7.x86_64                                                                                                 3/21
  Verifying  : glibc-headers-2.17-222.el7.x86_64                                                                                              4/21
  Verifying  : zfs-0.7.9-1.el7_5.x86_64                                                                                                       5/21
  Verifying  : glibc-devel-2.17-222.el7.x86_64                                                                                                6/21
  Verifying  : spl-0.7.9-1.el7_5.x86_64                                                                                                       7/21
  Verifying  : libzfs2-0.7.9-1.el7_5.x86_64                                                                                                   8/21
  Verifying  : kernel-headers-3.10.0-862.3.3.el7.x86_64                                                                                       9/21
  Verifying  : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                   10/21
  Verifying  : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                   11/21
  Verifying  : elfutils-libelf-devel-0.170-4.el7.x86_64                                                                                      12/21
  Verifying  : sysstat-10.1.5-13.el7.x86_64                                                                                                  13/21
  Verifying  : libuutil1-0.7.9-1.el7_5.x86_64                                                                                                14/21
  Verifying  : mpfr-3.1.1-4.el7.x86_64                                                                                                       15/21
  Verifying  : zfs-dkms-0.7.9-1.el7_5.noarch                                                                                                 16/21
  Verifying  : libzpool2-0.7.9-1.el7_5.x86_64                                                                                                17/21
  Verifying  : lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64                                                                         18/21
  Verifying  : libnvpair1-0.7.9-1.el7_5.x86_64                                                                                               19/21
  Verifying  : dkms-2.6.1-1.el7.noarch                                                                                                       20/21
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                                                                                     21/21

Installed:
  zfs.x86_64 0:0.7.9-1.el7_5

Dependency Installed:
  cpp.x86_64 0:4.8.5-28.el7_5.1              dkms.noarch 0:2.6.1-1.el7                                 elfutils-libelf-devel.x86_64 0:0.170-4.el7
  gcc.x86_64 0:4.8.5-28.el7_5.1              glibc-devel.x86_64 0:2.17-222.el7                         glibc-headers.x86_64 0:2.17-222.el7
  kernel-devel.x86_64 0:3.10.0-862.3.3.el7   kernel-headers.x86_64 0:3.10.0-862.3.3.el7                libmpc.x86_64 0:1.0.1-3.el7
  libnvpair1.x86_64 0:0.7.9-1.el7_5          libuutil1.x86_64 0:0.7.9-1.el7_5                          libzfs2.x86_64 0:0.7.9-1.el7_5
  libzpool2.x86_64 0:0.7.9-1.el7_5           lm_sensors-libs.x86_64 0:3.4.0-4.20160601gitf9185e5.el7   mpfr.x86_64 0:3.1.1-4.el7
  spl.x86_64 0:0.7.9-1.el7_5                 spl-dkms.noarch 0:0.7.9-1.el7_5                           sysstat.x86_64 0:10.1.5-13.el7
  zfs-dkms.noarch 0:0.7.9-1.el7_5            zlib-devel.x86_64 0:1.2.7-17.el7

Complete!

# which zpool
/usr/sbin/zpool

入った

[root@localhost ~]# modprobe zfs
modprobe: FATAL: Module zfs not found.

入ってなかった

なんかごちゃごちゃいじってたら動いた…
この辺見てた
FPGAで遊ぶ [CentOS]ZFSインストール成功(7.2) http://bobgosso.blog13.fc2.com/blog-entry-547.html

CentOS7.4 で ZFS な iSCSI ターゲットを作成する – Qiita https://qiita.com/AnaKutsu/items/4094cadbab1bb0596967

[root@storage02 ~]# zpool list
The ZFS modules are not loaded.
Try running '/sbin/modprobe zfs' as root to load them.
[root@storage02 ~]# /sbin/modprobe zfs
[root@storage02 ~]# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   ramfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cpuset
nodev   tmpfs
nodev   devtmpfs
nodev   debugfs
nodev   securityfs
nodev   sockfs
nodev   dax
nodev   pipefs
nodev   anon_inodefs
nodev   configfs
nodev   devpts
nodev   hugetlbfs
nodev   autofs
nodev   pstore
nodev   mqueue
nodev   selinuxfs
        xfs
nodev   binfmt_misc
nodev   zfs

プール作成

[root@storage02 ~]# zpool create tank raidz /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde

見る

[root@storage02 ~]# zpool status
  pool: tank
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            sda     ONLINE       0     0     0
            sdb     ONLINE       0     0     0
            sdc     ONLINE       0     0     0
            sdd     ONLINE       0     0     0
            sde     ONLINE       0     0     0

errors: No known data errors
[root@storage02 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   33G  1.6G   31G   5% /
devtmpfs                 1.8G     0  1.8G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  8.8M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sdf1               1014M  181M  834M  18% /boot
tmpfs                    371M     0  371M   0% /run/user/0
tank                      11T  128K   11T   1% /tank

めでたしめでたし

どのSATAポートに繋げたHDDがどこにマウントされてるか調べる方法

最初に全部入れると、どこのSATAポートがどのHDDかいつも忘れるれるのでメモ

インストール

#yum -y install smartmontools

何がマウントされてるか確認

[root@localhost ~]# smartctl --scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/sdc -d scsi # /dev/sdc, SCSI device
/dev/sdd -d scsi # /dev/sdd, SCSI device
/dev/sde -d scsi # /dev/sde, SCSI device

# smartctl /dev/sda -i
# smartctl /dev/sdb -i
# smartctl /dev/sdc -i
# smartctl /dev/sdd -i
# smartctl /dev/sde -i

sdbに何のHDDが刺さってるか確認
Device ModelとかSerial NumberをHDDに書いてあるシール?と照らし合わせる

# smartctl /dev/sdb -i
smartctl 6.5 2016-05-07 r4318 [x86_64-linux-3.10.0-693.el7.x86_64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Toshiba 3.5" MD04ACA... Enterprise HDD
Device Model:     TOSHIBA MD04ACA300
Serial Number:    にゃーん
LU WWN Device Id: にゃーん?
Firmware Version: FP1A
User Capacity:    3,000,592,982,016 bytes [3.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Mon Jun 25 22:37:08 2018 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

あとは適当にHDD(物理)にマウントポイントをメモ書きしとく

本来SMARTを調べるコマンドなのでもうちょっと使いこなしたい…

centos7にnodejs8を入れようとして入らなかった

入ってないのを確認

[root@10 ~]# yum remove -y nodejs npm
Loaded plugins: fastestmirror
Repository nodesource is listed more than once in the configuration
Repository nodesource-source is listed more than once in the configuration
No Match for argument: nodejs
No Match for argument: npm
No Packages marked for removal

インストール

[root@10 ~]# curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

## Installing the NodeSource Node.js 8.x repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.KfgLZx2d66' 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.KfgLZx2d66'

## Cleaning up...

+ rm -f '/tmp/tmp.KfgLZx2d66'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `yum install -y nodejs` (as root) to install Node.js 8.x and npm.
## You may also need development tools to build native addons:
##   `yum install -y gcc-c++ make`


[root@10 ~]# yum install -y nodejs
Loaded plugins: fastestmirror
Repository nodesource is listed more than once in the configuration
Repository nodesource-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:6.13.0-1nodesource will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package      Arch         Version                       Repository        Size
================================================================================
Installing:
 nodejs       x86_64       2:6.13.0-1nodesource          nodesource        13 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 13 M
Installed size: 38 M
Downloading packages:
nodejs-6.13.0-1nodesource.x86_64.rpm                       |  13 MB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:nodejs-6.13.0-1nodesource.x86_64                           1/1
  Verifying  : 2:nodejs-6.13.0-1nodesource.x86_64                           1/1

Installed:
  nodejs.x86_64 2:6.13.0-1nodesource

Complete!
[root@10 ~]# node -v
v6.13.0

えぇ。。。

CloudStackのチューニングしてみた

Apache CloudStack Advent Calendar 2015の12月9日の分を担当します。

80人くらいが同時にインスタンスを建てようとすると、APIがロック?と言うか、
画面更新などはできるが実行結果が帰ってこない状態(極端に遅いだけ?)になりました。
解決方法がよく分からず、#CloudStack のハッシュタグを付けてツイートしたら解決方法を教えてくださったので、
メモ程度ですが、残しときます。

※時間がなく、今この値で動かないからこんぐらいにしとけば動くだろう っと言う適当さです。

環境
CentOS 6.6
CloudStack 4.4.4
java version “1.7.0_85”
mysql Ver 14.14

とのことなので、Performance Test Execution for 4.2 – Apache Cloudstack – Apache Software Foundationを見ながらチューニング

とりあえず、MySQLから
MySQLTunerを使い基本的なチューニング

    query_cache_size (>= 8M)
    join_buffer_size (> 128.0K, or always use indexes with joins)
    thread_cache_size (start at 4)
    table_open_cache (> 64)
    innodb_buffer_pool_size (>= 506M) if possible.
    innodb_log_buffer_size (>= 1M)

MySQLTunerの結果を見つつwikiに乗ってるmy.cnfをにらめっこしつつ設定を変えてく

一部抜粋

innodb_buffer_pool_size = 1024M
innodb_log_buffer_size = 4M
key_buffer_size = 512M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M

slow_query_log_file = /var/lib/mysql/slow-queries.log
long_query_time = 5
max_heap_table_size = 2048M
query_cache_size = 0
thread_cache_size = 4

あとはtomcatのチューニング
どこ変更したか覚えてないので何となくで書きます…
/etc/cloudstack/management/tomcat6.conf
JAVA_OPTS の -Xms2g -Xmx4g とか  -XX:PermSize=1024m -XX:MaxPermSize=1024m とか追加した気がします
/etc/cloudstack/management/server-nonssl.xml のなかのmaxThreadsとか変更しました

【java チューニング】とか【tomcat チューニング】でググッて出てきたのを変更しました

設定変更後

service cloudstack-management restart

でcloudstackを再起動させて起動確認

結果
一斉にインスタンスを作ると【インスタンスの作成エラー】的なエラーが出るものの、インスタンス一覧の画面に戻るときちんと作成されてました。
一斉にインスタンスが作れるのを確認できたのでおkとしました。

時間がなく「今この値で動かないからこんぐらいにしとけば動くだろう」って言う感じのチューニングでしたが、
次はちゃんとログなどにらめっこしつつ論理的にチューニングしていきたいです。(小並感

Raspberry Pi 2 Model B にPidora入れたかった

Raspberry Pi 2 Model B にPidora入れてUSBケーブル挿したけど赤いLEDがついただけだった
raspbian見たいにダウンロードして書き込めばいいのかなーっと思ったけど何故か動かなかった

USBケーブル指しても赤いLEDが付くだけ
何でだろう、そのうち調べてみます。(とりあえず、記事書くって言う意思表示)
バージョンはPidora-2014-R3です

raspbianを入れるときに見たサイト
Raspberry Pi 2 Model B をインストールしてSSH接続できるようにしてみる – CLARA ONLINE techblog

Raspberry Pi 2 Model B 買いました


Twitterで入荷したとの事なので前から特に意味わないけど欲しかったので買いにいきました

店に行って店員さんに「Raspberry Pi2 ありますー?」って聞いたら「これが最後の一個です」みたいな事言われた
買えてよかった(小並感

さぁ、こいつでどう遊ぶか…

2015-03-27 22.28.39

OpenStack Icehouse を CentOS 6.5 に入れた時のメモ

# packstack --allinone
Welcome to Installer setup utility

Installing:
Clean Up                                             [ DONE ]
Setting up ssh keys                                  [ DONE ]
root@192.168.xx.yy's password:
root@192.168.xx.yy's password:
root@192.168.xx.yy's password:
Discovering hosts' details                        [ ERROR ]

ERROR : Failed to run remote script, stdout:
stderr: Warning: Permanently added '192.168.xx.yy' (RSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

sshの設定でrootログイン禁止にしてたらこんなエラー出ました

vim /etc/ssh/sshd_config

#no からyesに変更
PermitRootLogin yes

XenServerにHDDを追加メモ

XenServer6.2でHDDを追加した時のメモ

xenserver HDD 追加メモ | Notes http://sakura.mylines.org/wordpress/2011/03/xenserver-hdd-%E8%BF%BD%E5%8A%A0%E3%83%A1%E3%83%A2/

XenServerに物理ハードディスクを追加してみた – yoshida_eth0の日記 http://d.hatena.ne.jp/eth0jp/20100614/1276454721

要するに

xe sr-create type=lvm content-type=user device-config:device=/dev/sdb1 name-label="Local storage 2"

/dev/sdb1と
Local storage 2を変えればおk

XenCenterを見るとLocal storage 2が追加されてる

コマンドを入力する左側の表示を変更する

前回、さくらレンタルサーバーでcshからbashに変更しました。

変更したのはいいが、コマンドを入力する左側(名前わかんない)がディレクトリ移動する度に増えてくという仕様になっているので変更していきます。

現在こんな感じ

[ユーザー名@サーバー名 ~/www/sekki/hoge/fuga/ber(まだまだ増えるよ!)]$

左側の表示する方法の環境変数を確認

$ echo $PS1
[\u@\h \w]\$ 

変更

$ export PS1='[\u@\h \W]:\!$ '

現在居るディレクトリ名だけ表示される
メデタシメデタシ

[ユーザー名@サーバー名 ber]:51$

一々打つのめんどいので.bashrcに書き込む

echo "export PS1='[\u@\h \W]:\!$ '" >> ~/.bashrc

以上!

詳しくは 第8回:環境設定を変更してみる! | ConoHa http://www.conoha.jp/conoha/learning/1748.html ここを参考に

さくらレンタルサーバーのデフォルトのシェルを変更する

何番煎じかわからないですが…

さくらレンタルサーバーのスタンダードプランのOSはFreeBSDでデフォルトのシェルはcshみたいです。
いつもbash使っているのでTabで保管してくれないのは物凄く面倒…

なので、bashに変更してみました。やり方は簡単

とりあえず、今何のシェルを使ってるか確認

% echo $SHELL
/bin/csh

どんなシェルが使えるか確認

% cat /etc/shells
# $FreeBSD: release/9.1.0/etc/shells 59717 2000-04-27 21:58:46Z ache $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh
/usr/bin/passwd

今回はbashを使うので下記のコマンドを打つ
パスワードを打つ必要が有る

% chsh -s /usr/local/bin/bash
Password:
chsh: user information updated

ログインし直すとbashになってる。
.bashrcと.bash_profileを作る

vim .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions
alias ll='ls -l'

vim .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

以上です。

次は
コマンドを入力する左側がディレクトリ移動する度に増えてくという問題に当たったので変更していきます。
コマンドを入力する左側の表示を変更する