如何在 root 上配置 ZFS 的自动安装

如何在 root 上配置 ZFS 的自动安装

我尝试自动安装 ubuntu 服务器,提供文档中所述的用户数据文件,但具体来说是针对 Virtualbox 上 ZFS 上的 root。我按照 cloud-init 文档设置用户数据文件的存储部分。我实现了文档中显示的“ZFS Root Simple”和“ZFS Root”示例。简单的一个可以正常工作,但第二个不起作用,弹出的 subiquity 错误是“自动安装配置未挂载 root”。我无法弄清楚配置有什么问题,尽管它来自文档。

配置文件如下所示:

#cloud-config
autoinstall:
  version: 1
  identity:
    hostname: ubuntu-server
    password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
    username: ubuntu
  keyboard:
    layout: fr
  early-commands:
    - "sudo apt-get install zfsutils-linux -y"
  storage:
    config:
      - grub_device: true
        id: disk1
        name: main_disk
        ptable: gpt
        path: /dev/sda
        type: disk
        wipe: superblock
      - device: disk1
        id: disk1p1
        number: 1
        size: 9G
        type: partition
      - device: disk1
        flag: bios_grub
        id: bios_boot
        number: 2
        size: 1M
        type: partition
      - id: disk1_rootpool
        mountpoint: /
        pool: rpool
        type: zpool
        vdevs:
          - disk1p1
      - id: disk1_rootpool_container
        pool: disk1_rootpool
        properties:
          canmount: "off"
          mountpoint: "none"
        type: zfs
        volume: /ROOT
      - id: disk1_rootpool_rootfs
        pool: disk1_rootpool
        properties:
          canmount: noauto
          mountpoint: /
        type: zfs
        volume: /ROOT/zfsroot
      - id: disk1_rootpool_home
        pool: disk1_rootpool
        properties:
          setuid: "off"
        type: zfs
        volume: /home
      - id: disk1_rootpool_home_root
        pool: disk1_rootpool
        type: zfs
        volume: /home/root
        properties:
          mountpoint: /root
    version: 1

答案1

您可以在 中找到有关错误消息的更多详细信息/var/log/curtin/installer.log。我使用此自动安装配置取得了很大进展。仅在 proxmox VM 中对其进行了测试,因此 ymmv。

#cloud-config
autoinstall:
  apt:
    disable_components: []
    geoip: true
    preserve_sources_list: false
    primary:
    - arches:
      - amd64
      - i386
      uri: http://archive.ubuntu.com/ubuntu
    - arches:
      - default
      uri: http://ports.ubuntu.com/ubuntu-ports
  drivers:
    install: false
  identity:
    hostname: HOSTNAME
    password: PASSWORD
    realname: USER
    username: USER
  kernel:
    package: linux-generic
  keyboard:
    layout: us
    toggle: null
    variant: ''
  locale: en_US.UTF-8
  network:
    ethernets:
      ens18:
        critical: true
        dhcp-identifier: mac
        dhcp4: true
    version: 2
  ssh:
    allow-pw: true
    authorized-keys: []
    install-server: true
  storage:
    config:
    - ptable: gpt
      serial: 0QEMU_QEMU_HARDDISK_drive-scsi0
      path: /dev/sda
      wipe: superblock-recursive
      preserve: false
      name: ''
      grub_device: true
      type: disk
      id: disk1
    - device: disk1
      size: 1127219200
      wipe: superblock-recursive
      flag: boot
      number: 1
      preserve: false
      grub_device: true
      type: partition
      ptable: gpt
      id: disk1p1
    - fstype: fat32
      volume: disk1p1
      preserve: false
      type: format
      id: disk1p1fs1
    - path: /boot/efi
      device: disk1p1fs1
      type: mount
      id: mount-2
    - device: disk1
      size: -1
      wipe: superblock-recursive
      flag: root
      number: 2
      preserve: false
      grub_device: false
      type: partition
      id: disk1p2
    - id: disk1p2fs1
      type: format
      fstype: zfsroot
      volume: disk1p2
      preserve: false
    - id: disk1p2f1_rootpool
      mountpoint: /
      pool: rpool
      type: zpool
      device: disk1p2fs1
      preserve: false
      vdevs:
        - disk1p2fs1
    - id: disk1_rootpool_container
      pool: disk1p2f1_rootpool
      preserve: false
      properties:
        canmount: "off"
        mountpoint: "none"
      type: zfs
      volume: /ROOT
    - id: disk1_rootpool_rootfs
      pool: disk1p2f1_rootpool
      preserve: false
      properties:
        canmount: noauto
        mountpoint: /
      type: zfs
      volume: /ROOT/zfsroot
    - path: /
      device: disk1p2fs1
      type: mount
      id: mount-disk1p2
    swap:
      swap: 0
  early-commands:
    - "sudo apt-get install zfsutils-linux -y"
  updates: security
  version: 1

答案2

我遇到了同样的问题,看来这个问题应该在下一版本的 subuquity Ubuntu Server 安装程序中得到修复。当检查 root 是否已挂载时,zpool如果mountpoint是,它现在将接受存储类型对象/

这里 (0e1da11c3)对于来自项目存储库的此更改的提交:https://github.com/canonical/subiquity

相关内容