GRUBで読みやすいZFS zpoolを作成する方法

GRUBで読みやすいZFS zpoolを作成する方法

Arch Linux ZFS Wikiページに記載されています。grub互換プールの作成、良いこのページはFedoraのブートに関するものです。ただし、Grub読み取り可能プールを作成できません。 Arch Linux WikiページについてZFSへのArch Linuxのインストール特定のエラーは、これを克服する方法を実際に説明せずに強調表示されます。

リンクされたページでは、Grubサポートのサブセットについて説明します。zpool機能サポートされていない機能を使用するプールでは読み取れません。引き続き適切なプールを構成する方法について説明しますが、正しく機能させることはできません。サポートされている機能のサブセットはどこにも文書化されていないようです。

私は仮想マシンを使用して、最新のパッケージバージョンzfs-linuxzfs-linux-0.7.9.4.16.13.1-1)と互換性のあるGrub 2.02およびArch Linuxカーネル4.16.13-1-ARCHをテストしています。私はGrubがzpoolを読むことができることを証明するために(まだ)起動可能なシステムを作成しようとしませんでした。私が試したことは次のとおりです。

まず、Vault Wikiページ次の方法で不要な機能を無効にすることをお勧めします。

# zpool create \
    -o feature@multi_vdev_crash_dump=disabled \
    -o feature@large_dnode=disabled           \
    -o feature@sha512=disabled                \
    -o feature@skein=disabled                 \
    -o feature@edonr=disabled                 \
    testpool mirror \
    /dev/disk/by-id/ata-VBOX_HARDDISK_VB{5f2d4170-647f16b7,f38966d8-57bff7df}

その結果、次の機能が発生します。

testpool  feature@async_destroy          enabled                       local
testpool  feature@empty_bpobj            active                        local
testpool  feature@lz4_compress           active                        local
testpool  feature@multi_vdev_crash_dump  disabled                      local
testpool  feature@spacemap_histogram     active                        local
testpool  feature@enabled_txg            active                        local
testpool  feature@hole_birth             active                        local
testpool  feature@extensible_dataset     active                        local
testpool  feature@embedded_data          active                        local
testpool  feature@bookmarks              enabled                       local
testpool  feature@filesystem_limits      enabled                       local
testpool  feature@large_blocks           enabled                       local
testpool  feature@large_dnode            disabled                      local
testpool  feature@sha512                 disabled                      local
testpool  feature@skein                  disabled                      local
testpool  feature@edonr                  disabled                      local
testpool  feature@userobj_accounting     active                        local

だから、良いFedoraの帽子の例、必要な機能を有効にすることで:

zpool create -d \
    -o feature@async_destroy=enabled \
    -o feature@empty_bpobj=enabled \
    -o feature@spacemap_histogram=enabled \
    -o feature@enabled_txg=enabled \
    -o feature@hole_birth=enabled \
    -o feature@bookmarks=enabled \
    -o feature@embedded_data=enabled \
    -o feature@large_blocks=enabled \
    testpool mirror \
    /dev/disk/by-id/ata-VBOX_HARDDISK_VB{5f2d4170-647f16b7,f38966d8-57bff7df}

その結果、次の機能が発生します。

# zpool get all testpool | grep feature
testpool  feature@async_destroy          enabled                       local
testpool  feature@empty_bpobj            active                        local
testpool  feature@lz4_compress           disabled                      local
testpool  feature@multi_vdev_crash_dump  disabled                      local
testpool  feature@spacemap_histogram     active                        local
testpool  feature@enabled_txg            active                        local
testpool  feature@hole_birth             active                        local
testpool  feature@extensible_dataset     enabled                       local
testpool  feature@embedded_data          active                        local
testpool  feature@bookmarks              enabled                       local
testpool  feature@filesystem_limits      disabled                      local
testpool  feature@large_blocks           enabled                       local
testpool  feature@large_dnode            disabled                      local
testpool  feature@sha512                 disabled                      local
testpool  feature@skein                  disabled                      local
testpool  feature@edonr                  disabled                      local
testpool  feature@userobj_accounting     disabled                      local

それぞれの場合にいくつかのコンテンツをロードしました。

# cp -a /boot /testpool

その後、Grubで再起動します。

grub> search --set --label testpool
grub> ls /
@/
grub> ls /@
error: compression algorithm 80 not supported
.
grub> ls /@/
error: compression algorithm inherit not supported
.

特定の機能、特にlz4_compress。また、プールにデータセットを作成してみました。 Grubで試したことは何もありません。

/bootまたはをリストできることを願っています/@/boot

発生したエラーは次のとおりです。

  • compression algorithm inherit not supported
  • compression algorithm 66 not supported
  • compression algorithm 80 not supported
  • incorrect dnode type

Grubで読むためにZFS zpoolを作成するにはどうすればよいですか?

ベストアンサー1

Grubは、次のエラーによりzpoolのディレクトリリストを確実に実行できません。メーリングリストで確認:

Grubのディレクトリコンテンツのリストが壊れており、特定の問題を解決するパッチがあります。奇妙なエラーメッセージ(誤ったBPタイプや圧縮アルゴリズムなど)が表示された場合は、これが問題である可能性が高くなります。

この問題は、ArchLinuxとFedora 28のGrubインストールに存在します。しかし、Ubuntuはこの問題を解決するためにGrubをパッチしたようです(Ubuntu 16.10で確認済み)。

ただし、Grubは起動に必要なファイルを読み取ることができます。 Grubが次のように起動するzpoolを作成できます。

zpool create -m none "$ZPOOL" "$RAIDZ" "${DISKS[@]}"

ここで、変数はプール名(例)mypool、RAIDレベル(例)、mirrorおよびディスク(/dev/disk/by-id/...ミラーリングには2つのディスクが必要です)を定義します。

データセットを作成する必要があります。

zfs create -p "$ZPOOL"/ROOT/archlinux

データセットのマウントポイントを設定する必要があります。

zfs set mountpoint=/ "$ZPOOL"/ROOT/archlinux

その後、次のコマンドを使用してGrubから起動できます。

insmod part_gpt
search --set --label mypool
linux /ROOT/archlinux@/boot/vmlinuz-linux zfs=mypool rw
initrd /ROOT/archlinux@/boot/initramfs-linux.img
boot

これを書いたVirtualBoxシステムでテストしてみてください。 ISOのArchを通常のext4ルートにインストールし、それを使用して2つのミラー化仮想ディスクに新しいZFSルートをマウントしました。まとめです - ご覧くださいスクリプト詳細を確認してください。

おすすめ記事