服务器自动安装:如何自定义存储部分?

zar*_*rej 3 server automatic cloud-init 20.04

按照这里的指令https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls#Running_a_truly_automatic_autoinstall 当我用于存储时:

storage:
  layout:
    name: lvm
Run Code Online (Sandbox Code Playgroud)

它创建 4GB 的根分区并且不创建交换。当我使用直接布局时

storage:
  layout:
    name: direct
Run Code Online (Sandbox Code Playgroud)

它创建具有磁盘上可用空间的根分区,并创建交换。有什么方法可以直接查看它是如何配置布局并修改该配置来调整我的需求的?我的意思是使用基于操作的配置,例如记录在此处:https : //wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference#storage

我的意思是类似以下内容:

storage:
  grub:
    install_devices:
      - esp-partition   
  swap:
    filename: swap.img
    size: 4GB
  config:
    - type: disk
      id: disk0
      ptable: gpt
      wipe: superblock
      grub_device: true
      match:
        size: largest

    - id: esp-partition # create partitions on disk (like sda1)
      type: partition
      device: disk0
      size: 512MB
      flag: boot # EFI system partition needs boot flag
    - type: partition
      id: boot-partition
      device: disk0
      size: 1GB
    - type: partition
      device: disk0
      id: root-partition
      size: -1

    - id: esp-partition-fs # format partitions on disk
      type: format
      volume: esp-partition
      fstype: fat32
      label: ESP
    - id: boot-partition-fs
      type: format
      fstype: ext4
      volume: boot-partition
    - id: root-partition-fs
      type: format
      fstype: ext4
      volume: root-partition

    - id: esp-partition-fs-mount # mount partitions
      type: mount
      device: esp-partition-fs
      path: /boot/efi
    - id: root-partition-fs-mount
      type: mount
      path: /
      device: root-partition-fs
    - id: boot-partition-fs-mount
      type: mount
      path: /boot
      device: boot-partition-fs
Run Code Online (Sandbox Code Playgroud)

以上配置成功通过 FileSystem 步骤,但在 cloud-init 配置的 initramfs 步骤失败。喜欢截图 在此处输入图片说明 我想知道直接布局的存储配置,以便我可以调整上面的配置,或者如果有人知道帮助我如何修复上面的配置所以步骤 initramfs 通过?

小智 8

第一次通过我经历了手动安装。然后你会发现/var/log/installer有 yaml 文件可以用作autoinstall.yaml你想要的实际模板。这就是我然后构建以用 aoutinstall 替换 Debian 安装程序 preseed 的内容。

  storage:
    config:
    - grub_device: true
      id: disk-sda
      path: /dev/sda
      ptable: gpt
      type: disk
      wipe: superblock-recursive
    - device: disk-sda
      flag: bios_grub
      id: partition-0
      number: 1
      size: 1048576
      type: partition
    - device: disk-sda
      id: partition-1
      number: 2
      size: -1
      type: partition
      wipe: superblock
    - fstype: ext4
      id: format-0
      type: format
      volume: partition-1
    - device: format-0
      id: mount-0
      path: /
      type: mount
Run Code Online (Sandbox Code Playgroud)