我在 ubuntu 20.04 服务器操作系统上使用 maas 2.9 来安装 ubuntu 20.04 映像。
问题 1:如何利用剩余空间创建最后一个分区?
为了创建自定义存储配置,我添加了以下代码:
storage:
version: 1
config:
- id: sda
type: disk
wipe: superblock
ptable: gpt
model: VOLUME1 DISK
serial: 5000c500bbe76fab
grub_device: true
# Create a partition for boot
- id: sda1
type: partition
size: 3G
device: sda
name: boot-partition
wipe: superblock
- id: sda-boot
type: format
fstype: ext4
label: BOOT
# Get volume name from partition id
volume: sda1
#Mount this on boot
- id: sda1-mount
type: mount
path: /boot
#Get device name from format id
device: sda-boot
#Create partition for boot efi
- id: sda2
type: partition
size: 500M
device: sda
name: bootefi-partition
wipe: superblock
- id: sda-bootefi
type: format
fstype: fat32
label: BOOTEFI
volume: sda2
#Mount this on boot
- id: sda2-mount
type: mount
path: /boot/efi
device: sda-bootefi
#Create partition for usr
- id: sda3
type: partition
size: 20G
device: sda
name: usr-partition
wipe: superblock
- id: sda-usr
type: format
fstype: xfs
label: USR
volume: sda3
#Mount this on usr
- id: sda3-mount
type: mount
path: /usr
device: sda-usr
#Create partition for TMP
- id: sda4
type: partition
size: 5G
device: sda
name: tmp-partition
wipe: superblock
- id: sda-tmp
type: format
fstype: xfs
label: TMP
volume: sda4
#Mount this on tmp
- id: sda4-mount
type: mount
path: /tmp
device: sda-tmp
#Create partition for ROOT
- id: sda5
type: partition
size: 50G
device: sda
name: root-partition
wipe: superblock
flag: boot
- id: sda-root
type: format
fstype: xfs
label: ROOT
volume: sda5
#Mount this on /
- id: sda5-mount
type: mount
path: /
device: sda-root
#Create partition for HOME
- id: sda6
type: partition
size: 50G
device: sda
name: home-partition
wipe: superblock
- id: sda-home
type: format
fstype: xfs
label: HOME
volume: sda6
#Mount this on /home
- id: sda6-mount
type: mount
path: /home
device: sda-home
#Create partition for VAR
- id: sda7
type: partition
size: -1
device: sda
name: var-partition
wipe: superblock
#Format partition for var
- id: sda-var
type: format
fstype: xfs
label: VAR
volume: sda7
#Mount this on var
- id: sda7-mount
type: mount
path: /var
device: sda-var
我收到以下错误:
previous partition number for 'sda7' found to be '7'
partition_kname=sda7
previous partition: /sys/class/block/sda/sda7 size_sectors=104857600 start_sectors=164605952
adding partition 'sda7' to disk 'sda' (ptable: 'gpt')
partnum: 8 offset_sectors: 269463552 length_sectors: -1
Preparing partition location on disk /dev/sda
Wiping 1M on /dev/sda at offset 137965338624
Running command ['sgdisk', '--new', '8:269463552:269463551', '--typecode=8:8300', '/dev/sda'] with allowed return codes [0] (capture=True)
An error occured handling 'sda7': ProcessExecutionError - Unexpected error while running command.
Command: ['sgdisk', '--new', '8:269463552:269463551', '--typecode=8:8300', '/dev/sda']
Exit code: 4
Reason: -
Stdout: ''
Stderr: Could not create partition 8 from 269463552 to 269463551
Could not change partition 8's type code to 8300!
Error encountered; not saving changes.
finish: cmd-install/stage-partitioning/builtin/cmd-block-meta: FAIL: configuring partition: sda7
TIMED BLOCK_META: 23.273
finish: cmd-install/stage-partitioning/builtin/cmd-block-meta: FAIL: curtin command block-meta
Traceback (most recent call last):
File "/curtin/curtin/commands/main.py", line 202, in main
ret = args.func(args)
File "/curtin/curtin/log.py", line 97, in wrapper
return log_time("TIMED %s: " % msg, func, *args, **kwargs)
File "/curtin/curtin/log.py", line 79, in log_time
return func(*args, **kwargs)
File "/curtin/curtin/commands/block_meta.py", line 111, in block_meta
return meta_custom(args)
File "/curtin/curtin/commands/block_meta.py", line 1916, in meta_custom
handler(command, storage_config_dict)
File "/curtin/curtin/commands/block_meta.py", line 934, in partition_handler
util.subp(cmd, capture=True)
File "/curtin/curtin/util.py", line 275, in subp
return _subp(*args, **kwargs)
File "/curtin/curtin/util.py", line 139, in _subp
raise ProcessExecutionError(stdout=out, stderr=err,
curtin.util.ProcessExecutionError: Unexpected error while running command.
Command: ['sgdisk', '--new', '8:269463552:269463551', '--typecode=8:8300', '/dev/sda']
Exit code: 4
Reason: -
Stdout: ''
Stderr: Could not create partition 8 from 269463552 to 269463551
Could not change partition 8's type code to 8300!
Error encountered; not saving changes.
Unexpected error while running command.
Command: ['sgdisk', '--new', '8:269463552:269463551', '--typecode=8:8300', '/dev/sda']
Exit code: 4
Reason: -
Stdout: ''
Stderr: Could not create partition 8 from 269463552 to 269463551
Could not change partition 8's type code to 8300!
Error encountered; not saving changes.
有人能告诉我应该为尺寸字段提供什么值吗?
问题 2:如果我将最后一个分区的大小定义为固定值,则操作系统安装成功。但在首次启动时,找不到 /root 分区
错误有点像下面这样:
/usr clean mount ok
/root/lib : mkdir failed
/sbin/ : not found
谢谢