I used a PXE install on a computer with the following relevant parameters in user-data:
storage:
layout:
name: lvm
match:
ssd: yes
meaning the SSD (machine only contains one) should be formatted and partitioned automatically.
After the installation finishes the partition information is as I expected
sudo partx -s /dev/sda
NR START END SECTORS SIZE NAME UUID
1 2048 4095 2048 1M c22ce821-a730-4ba4-9992-3014acb4c332
2 4096 2101247 2097152 1G 24379366-30d3-4967-b9d7-31a42ea2043d
3 2101248 250066943 247965696 118.2G d15a6cd2-b73e-427b-b7ea-0d99f6c6fce5
Yet free space is only about half what it should be. Also their are weird extra mounts
sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 29.9M 1 loop /snap/snapd/8790
loop1 7:1 0 55.3M 1 loop /snap/core18/1885
loop2 7:2 0 71.5M 1 loop /snap/lxd/16740
sda 8:0 0 119.2G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 118.2G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 59.1G 0 lvm /
How can I set the auto installer parameters that I have the whole 118.2G available?
Thanks in advance.
[Workaround]
If you replace name: lvm
with name: direct
I get the full capacity but then obviousl LVM is not working. The Machine also then does not seem to have a separate boot partition:
sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 29.9M 1 loop /snap/snapd/8790
loop1 7:1 0 55.3M 1 loop /snap/core18/1885
loop2 7:2 0 71.5M 1 loop /snap/lxd/16740
sda 8:0 0 119.2G 0 disk
├─sda1 8:1 0 1M 0 part
└─sda2 8:2 0 119.2G 0 part /
I would prefer to have the full capacity available with LVM.
[/Workaround]
[Config with LVM]
pxelinux.cfg:
DEFAULT install
LABEL install
KERNEL vmlinuz
INITRD initrd
APPEND root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=http://10.2.1.20/efi_focal/ubuntu-20.04.1-live-server-amd64.iso autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disa>
user-data:
#cloud-config
autoinstall:
version: 1
early-commands:
- systemctl stop ssh # otherwise packer tries to connect and exceed max attempts
network:
network:
version: 2
ethernets:
eth0:
dhcp4: yes
dhcp-identifier: mac
optional: true
eth1:
dhcp4: yes
dhcp-identifier: mac
optional: true
eth2:
dhcp4: yes
dhcp-identifier: mac
optional: true
eth3:
dhcp4: yes
dhcp-identifier: mac
optional: true
eth4:
dhcp4: yes
dhcp-identifier: mac
optional: true
eth5:
dhcp4: yes
dhcp-identifier: mac
optional: true
locale: en_US
keyboard:
layout: de
apt:
http_proxy: http://10.2.1.1:8080/
https_proxy: http://10.2.1.1:8080/
preserve_sources_list: false
primary:
- arches: [amd64]
uri: "http://archive.ubuntu.com/ubuntu/"
storage:
layout:
name: lvm
match:
ssd: yes
ssh:
install-server: yes
allow-pw: yes
identity:
hostname: decosrv02
password: Hash of the PW
username: ipc
packages:
- net-tools
- docker
- docker-compose
user-data:
idisable_root: false
late-commands:
- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
- sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="net.ifnames=0 ipv6.disable=1 biosdevname=0"/' /target/etc/default/grub
- curtin in-target --target /target update-grub2
- apt-get update && apt-get upgrade -y
[/Config with LVM]
[resize by hand]
ipc@decosrv02:~$ sudo lvextend -l 100%FREE ubuntu--vg-ubuntu--lv
Please specify a logical volume path.
ipc@decosrv02:~$ sudo lvextend -l 100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
New size given (15134 extents) not larger than existing size (15135 extents)
ipc@decosrv02:~$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
The filesystem is already 15498240 (4k) blocks long. Nothing to do!
[/resize by hand]
layout
setting. You can configure the storage section explicitly. This would allow you to configure partitions, volume groups, and logical volumes. With logical volumes you can specify 100% as a size – Andrew Lowther Oct 01 '20 at 15:19