AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 447960
Accepted
starfry
starfry
Asked: 2018-06-06 02:51:14 +0800 CST2018-06-06 02:51:14 +0800 CST 2018-06-06 02:51:14 +0800 CST

如何创建 GRUB 可以读取的 ZFS zpool

  • 772

Arch Linux ZFS wiki 页面解释了与 grub 兼容的池创建,这个关于引导 Fedora 的页面也是如此,但我无法创建 Grub 可读的池。关于在 ZFS 上安装 Arch Linux的 Arch Linux wiki 页面突出显示了某些错误,但并没有真正解释如何克服这些错误。

链接页面说明 Grub 支持zpool 功能的子集,并且无法读取使用它不支持的功能的池。他们继续解释如何配置合适的池,但我无法使其工作。支持的功能子集似乎没有在任何地方记录。

我正在使用虚拟机测试 Grub 2.02 和 Arch Linux 内核 4.16.13-1-ARCH,这是最新的并且与当前的zfs-linux包版本 ( zfs-linux-0.7.9.4.16.13.1-1) 兼容。我(还没有)尝试制作可引导系统,只是为了证明 Grub 可以读取 zpool。这是我尝试过的:

首先,就像arch 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

应该如何创建 ZFS zpool 以便 Grub 可以读取它?

arch-linux grub2
  • 2 2 个回答
  • 8127 Views

2 个回答

  • Voted
  1. Best Answer
    starfry
    2018-06-19T13:56:05+08:002018-06-19T13:56:05+08:00

    由于通过邮件列表确认的错误,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/...(镜像需要两个磁盘)。

    您需要创建一个数据集

    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 机器上对其进行测试。我将 Arch 从 ISO 安装到一个普通的 ext4 根目录,然后用它在两个镜像虚拟磁盘上安装一个新的 ZFS 根目录。以上是一个摘要 - 有关完整详细信息,请参阅脚本。

    • 5
  2. Luca Citi
    2022-02-16T07:13:41+08:002022-02-16T07:13:41+08:00

    支持的功能子集似乎没有在任何地方记录。

    我可以找到支持的功能列表的唯一可靠的地方是 GRUB 的源代码(永久链接到今天的版本)。基本上所有只写功能加上那里明确列出的功能。

    • 0

相关问题

  • archlinux efi netboot 内核“ip”不起作用?systemd "启动 Switch Root 失败。"

  • 如何在 Arch Linux 上设置音频,支持多个程序同时发出音频而不创建 asoundrc?

  • 为什么有时需要手动导入密钥?

  • 在启动时加载设备

  • GRUB 配置以识别同一 Linux 发行版的不同桌面环境(安装)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    ssh 无法协商:“找不到匹配的密码”,正在拒绝 cbc

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    如何卸载内核模块“nvidia-drm”?

    • 13 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Wong Jia Hau ssh-add 返回:“连接代理时出错:没有这样的文件或目录” 2018-08-24 23:28:13 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST
  • Martin Hope
    Bagas Sanjaya 为什么 Linux 使用 LF 作为换行符? 2017-12-20 05:48:21 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve