我正在尝试创建云配置文件“填充磁盘”(lvm)。有人可以检查并告诉我问题是什么吗?(在 ubuntu20.4 服务器焦点上出现有关根卷的错误)
#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
identity:
hostname: ubuntu-test
password: $6$XhlhJBcl/bxTQcSDA$BLAJBLAatDUh53b/BOEk1.c38CvU4XdlYjeltLav8EGcjpth/or5N33tLye6Og4TESYHFVr7MQaVGUn1tz2o67/Mm/
realname: scadmin
username: scadmin
kernel:
package: linux-generic
keyboard:
layout: us
toggle: null
variant: ''
locale: en_US.UTF-8
network:
ethernets:
ens160:
dhcp4: true
version: 2
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
config:
- ptable: gpt
path: /dev/sda
wipe: superblock-recursive
preserve: false
name: ''
grub_device: true
type: disk
id: disk-sda
- device: disk-sda
size: 1048576
flag: bios_grub
number: 1
preserve: false
grub_device: false
type: partition
id: partition-0
- device: disk-sda
size: -1
wipe: superblock
flag: ''
number: 2
preserve: false
grub_device: false
type: partition
id: partition-1
- name: vg0
devices:
- partition-1
preserve: false
type: lvm_volgroup
id: lvm_volgroup-0
- name: lv-root
volgroup: lvm_volgroup-0
size: -1
wipe: superblock
preserve: false
type: lvm_partition
id: lvm_partition-0
- name: lv-swap
volgroup: lvm_volgroup-0
size: 4290772992B
wipe: superblock
preserve: false
type: lvm_partition
id: lvm_partition-1
- fstype: ext4
volume: lvm_partition-0
preserve: false
type: format
id: format-2
- path: /
device: format-2
type: mount
id: mount-2
- fstype: swap
volume: lvm_partition-1
preserve: false
type: format
id: format-3
- path: ''
device: format-3
type: mount
id: mount-3
swap:
swap: 0
updates: security
version: 1
答案1
首先通过重新排列存储配置条目来创建交换逻辑卷。
您创建一个将使用所有空间的根逻辑卷。
- name: lv-root
volgroup: lvm_volgroup-0
size: -1
wipe: superblock
preserve: false
type: lvm_partition
id: lvm_partition-0
然后您创建交换逻辑卷。
- name: lv-swap
volgroup: lvm_volgroup-0
size: 4290772992B
wipe: superblock
preserve: false
type: lvm_partition
id: lvm_partition-1
安装程序不喜欢这样。我收到了此错误日志(使用 22.04 安装程序)。
LVM_LogicalVolume(name='lv-root', volgroup=lvm_volgroup-0, size=-1, wipe='superblock', type='lvm_partition', id='lvm_partition-0') has negative size but is not final partition of LVM_VolGroup(name='vg0', devices=[partition-1], type='lvm_volgroup', id='lvm_volgroup-0')
答案2
preserve: false
grub_device: false
type: partition
id: partition-3
- fstype: ext4
volume: partition-3
preserve: false
type: format
id: format-0
- name: lv-swap
volgroup: lvm_volgroup-0
size: 4294967296B
wipe: superblock
preserve: false
type: lvm_partition
id: lvm_partition-0
- name: lv-root
volgroup: lvm_volgroup-0
size: 25765609472B
wipe: superblock
preserve: false
type: lvm_partition
id: lvm_partition-1
- fstype: ext4
volume: lvm_partition-1
preserve: false
type: format
id: format-3
- path: /
device: format-3
type: mount
id: mount-3
- fstype: swap
volume: lvm_partition-0
preserve: false
type: format
id: format-4
- path: ''
device: format-4
type: mount
id: mount-4
- path: /boot
device: format-0
type: mount
id: mount-0