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
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1244293
Accepted
43Tesseracts
43Tesseracts
Asked: 2020-05-28 10:45:33 +0800 CST2020-05-28 10:45:33 +0800 CST 2020-05-28 10:45:33 +0800 CST

如何在 Ubuntu 20.04 自动服务器安装上自动安装配置“填充磁盘”选项?

  • 772

我正在尝试使用像这样的自动安装配置文件安装 20.04 :

用户数据文件:

version: 1
identity:
    hostname: hostname
    username: username
    password: $crypted_pass

但是自动安装过程(将所有内容保留为默认值)不会对磁盘​​进行分区以使用所有空间,即使当我手动运行安装程序时这似乎是默认设置。

手动选择所有默认值后,我storage从/var/log/installer/autoinstall-user-data

  storage:
    config:
    - {ptable: gpt, serial: INTEL SSDPEKKF256G8L_BTHH85121P8H256B, wwn: eui.5cd2e42c81a42d1d,
      path: /dev/nvme0n1, wipe: superblock-recursive, preserve: false, name: '', grub_device: true,
      type: disk, id: disk-nvme0n1}
    - {device: disk-nvme0n1, size: 1048576, flag: bios_grub, number: 1, preserve: false,
      type: partition, id: partition-0}
    - {device: disk-nvme0n1, size: 256057016320, wipe: superblock, flag: '', number: 2,
      preserve: false, type: partition, id: partition-1}
    - {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-0}
    - {device: format-0, path: /, type: mount, id: mount-0}

但是,我不清楚从这里我需要在我的用户数据文件中包含什么才能选择“填充磁盘”选项?

system-installation partitioning cloud-init 20.04
  • 2 2 个回答
  • 5432 Views

2 个回答

  • Voted
  1. Best Answer
    Andrew Lowther
    2020-05-29T07:10:05+08:002020-05-29T07:10:05+08:00

    我没有尝试过,但文档建议负值将“填充”。

    来源:https ://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference#storage

    服务器安装程序允许将大小指定为包含设备的百分比。此外,可以为最终分区使用负大小,以指示该分区应使用所有剩余空间。

    编辑

    我试过了。用于size: -1最终分区确实填满了磁盘。我尝试使用LVM 逻辑卷来使用所有可用空间,但size: 100%它不起作用。安装程序在.size: -1align_downsubiquity/models/filesystem.py

    我也尝试过100%FREE,但subiquity出错了dehumanize_size

    我还尝试删除 size 属性,lvm_partition因为curtin文档说(在https://curtin.readthedocs.io/en/latest/topics/storage.html)

    如果省略 size 键,则 volgroup 上的所有剩余空间都将用于逻辑卷。

    如果没有属性,这不会作为subiquity错误起作用size

    这很不幸,因为对 LVM 卷使用百分比将是一个非常基本的用例

    我试过的完整存储配置。

      storage:
        grub:
          reorder_uefi: False
        swap:
          size: 0
        config:
        - {ptable: gpt, path: /dev/sda, preserve: false, name: '', grub_device: false,
          type: disk, id: disk-sda}
        - {device: disk-sda, size: 512M, wipe: superblock, flag: boot, number: 1,
          preserve: false, grub_device: true, type: partition, id: partition-sda1}
        - {fstype: fat32, volume: partition-sda1, preserve: false, type: format, id: format-2}
        - {device: disk-sda, size: 1G, wipe: superblock, flag: linux, number: 2,
          preserve: false, grub_device: false, type: partition, id: partition-sda2}
        - {fstype: ext4, volume: partition-sda2, preserve: false, type: format, id: format-0}
        - {device: disk-sda, size: -1, flag: linux, number: 3, preserve: false,
          grub_device: false, type: partition, id: partition-sda3}
        - name: vg-0
          devices: [partition-sda3]
          preserve: false
          type: lvm_volgroup
          id: lvm-volgroup-vg-0
        - {name: lv-root, volgroup: lvm-volgroup-vg-0, size: 100%, preserve: false,
          type: lvm_partition, id: lvm-partition-lv-root}
        - {fstype: ext4, volume: lvm-partition-lv-root, preserve: false, type: format,
          id: format-1}
        - {device: format-1, path: /, type: mount, id: mount-2}
        - {device: format-0, path: /boot, type: mount, id: mount-1}
        - {device: format-2, path: /boot/efi, type: mount, id: mount-3}
    

    编辑 2

    我一直在研究这个,似乎有时subiquity将磁盘大小存储为浮点数,这导致了未捕获的异常。我实际上能够通过不使用人类可读的格式来解决这个问题。例如,代替size: 512M, 使用size: 536870912.

    storage这是一个使用带有属性的自动填充选项的示例配置,size: -1还配置了一个逻辑卷以使用该属性填充卷组size: 100%

      storage:
        grub:
          reorder_uefi: False
        swap:
          size: 0
        config:
        - {ptable: gpt, path: /dev/sda, preserve: false, name: '', grub_device: false,
          type: disk, id: disk-sda}
        - {device: disk-sda, size: 536870912, wipe: superblock, flag: boot, number: 1,
          preserve: false, grub_device: true, type: partition, id: partition-sda1}
        - {fstype: fat32, volume: partition-sda1, preserve: false, type: format, id: format-2}
        - {device: disk-sda, size: 1073741824, wipe: superblock, flag: linux, number: 2,
          preserve: false, grub_device: false, type: partition, id: partition-sda2}
        - {fstype: ext4, volume: partition-sda2, preserve: false, type: format, id: format-0}
        - {device: disk-sda, size: -1, flag: linux, number: 3, preserve: false,
          grub_device: false, type: partition, id: partition-sda3}
        - name: vg-0
          devices: [partition-sda3]
          preserve: false
          type: lvm_volgroup
          id: lvm-volgroup-vg-0
        - {name: lv-root, volgroup: lvm-volgroup-vg-0, size: 100%, preserve: false,
          type: lvm_partition, id: lvm-partition-lv-root}
        - {fstype: ext4, volume: lvm-partition-lv-root, preserve: false, type: format,
          id: format-1}
        - {device: format-1, path: /, type: mount, id: mount-2}
        - {device: format-0, path: /boot, type: mount, id: mount-1}
        - {device: format-2, path: /boot/efi, type: mount, id: mount-3}
    

    看起来浮动错误可能已通过此提交修复,如果使用自动安装程序更新功能,可能会避免

    https://github.com/CanonicalLtd/subiquity/commit/8a84e470c59e292138482a0b1bd7144fbb4644db#diff-1ca44bce35f59e931cbe850119e630db

    • 6
  2. Rob Raymond
    2020-07-02T18:21:53+08:002020-07-02T18:21:53+08:00

    负尺寸确实有效。第二个分区设置为大小 -1 并使用所有可用空间。

      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
    
    • 2

相关问题

  • 如何从双启动计算机访问加密的主文件夹?

  • 您对台式机和家庭服务器的驱动器分区方案有什么建议?[关闭]

  • 安装时,我可以选择加密我的主文件夹——这是做什么的?

  • 在不使用标准升级系统的情况下升级有哪些替代方案?

Sidebar

Stats

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

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve