我正在尝试安装 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}
但是,我不清楚我需要在用户数据文件中包含什么内容才能选择“填充磁盘”选项?
答案1
我还没有尝试过,但是文档建议用负值来“填充”。
来源:https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference#storage
服务器安装程序允许将大小指定为包含设备的百分比。此外,可以为最后一个分区使用负数大小,以指示该分区应使用所有剩余空间。
编辑
我试过了。使用 来size: -1
作为最后一个分区确实填满了磁盘。我尝试使用size: 100%
和size: -1
来作为 LVM 逻辑卷以使用所有可用空间,结果确实如此不是工作。安装程序在align_down
中出错subiquity/models/filesystem.py
。
我也试过,100%FREE
但是下位性错误于dehumanize_size
我还尝试删除 size 属性,lvm_partition
因为科廷文档说(在https://curtin.readthedocs.io/en/latest/topics/storage.html)
如果省略大小键,则卷组上的所有剩余空间将用于逻辑卷。
这确实不是担任下位性如果没有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
我一直在研究这个问题,似乎有时候下位性将磁盘大小存储为浮点数,这会导致未捕获的异常。我实际上可以通过不使用人类可读的格式来解决这个问题。例如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}
看起来像是浮动错误可能已通过此提交修复,如果使用自动安装程序更新功能,可能会避免
答案2
负尺寸确实有效。第二个分区设置为尺寸 -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