Skip to content

Instantly share code, notes, and snippets.

@danielfaust
Last active May 19, 2025 10:55
Show Gist options
  • Save danielfaust/e7d8a21c1e739617236f97f1f7325d66 to your computer and use it in GitHub Desktop.
Save danielfaust/e7d8a21c1e739617236f97f1f7325d66 to your computer and use it in GitHub Desktop.
Ubuntu autoinstall YAML file with custom disk partitioning (EFI, boot, root, backups)
autoinstall:
version: 1
source:
id: ubuntu-desktop-minimal
timezone: 'Europe/Berlin'
locale: 'en_US.UTF-8'
keyboard:
layout: 'us'
variant: ''
identity:
realname: "ubuntu"
username: ubuntu
password: "$6$_____j1" # Use 'openssl passwd -6' to generate a hash
hostname: ubuntu
ssh:
install-server: true
allow-pw: true
codecs:
install: true
drivers:
install: true
storage:
config:
#---------------------------------------------------------------------
# disks
#---------------------------------------------------------------------
- type: disk
id: disk-0
name: disk-0
ptable: gpt
wipe: superblock-recursive
path: /dev/nvme0n1
#---------------------------------------------------------------------
# partitions
#---------------------------------------------------------------------
- type: partition
id: esp-partition
device: disk-0
flag: boot
# wipe: superblock-recursive
grub_device: true # efi boot partition MUST be grub_device
number: 1
size: 1G
- type: partition
id: boot-partition
device: disk-0
# wipe: superblock-recursive
number: 2
size: 2G
- type: partition
id: root-partition
device: disk-0
# wipe: superblock-recursive
number: 3
size: 512G
- type: partition
id: backups-partition
device: disk-0
# wipe: superblock-recursive
number: 4
size: -1
#---------------------------------------------------------------------
# logical volumes
#---------------------------------------------------------------------
- type: lvm_volgroup
id: root-volgroup
name: vgroot
devices:
- root-partition
- type: lvm_partition
id: root-vlm-partition
name: lvroot
volgroup: root-volgroup
# wipe: superblock-recursive
size: 128G
- type: lvm_partition
id: swap-vlm-partition
name: lvswap
volgroup: root-volgroup
# wipe: superblock-recursive
size: 48G
#---------------------------------------------------------------------
# file systems
#---------------------------------------------------------------------
- type: format
id: esp-format
volume: esp-partition
fstype: fat32
- type: format
id: boot-format
volume: boot-partition
fstype: ext4
- type: format
id: lvroot-format
volume: root-vlm-partition
fstype: ext4
- type: format
id: swap-format
volume: swap-vlm-partition
fstype: swap
- type: format
id: backups-format
volume: backups-partition
fstype: ext4
#---------------------------------------------------------------------
# mount points
#---------------------------------------------------------------------
- type: mount
id: efi-mount
device: esp-format
path: /boot/efi
- type: mount
id: boot-mount
device: boot-format
path: /boot
- type: mount
id: root-mount
device: lvroot-format
path: /
- type: mount
id: swap-mount
device: swap-format
path: none
#---------------------------------------------------------------------
# better mount backups manually, because if a snapshot has it in fstab,
# a system restore will fail to boot without errors if this partition
# is not restored as well, which it typically will not be
#---------------------------------------------------------------------
#- type: mount
# id: backups-mount
# device: backups-format
# path: /media/backups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment