MAAS × LXD

09 · Storage (CLI)

You can shape storage entirely from the CLI: choose a boot disk, create partitions, and assign filesystems and mount points. MAAS applies the layout at deploy time.

List block devices

maas admin block-devices read <SYSID> | jq -r '.[] | [.id, .name, .model, .size, .used_for] | @tsv' | column -t

Choose a boot disk and set GPT

maas admin block-device set-boot-disk <SYSID> <DEVID>
maas admin block-device update <SYSID> <DEVID> partition_table=gpt

Create partitions

# 512M EFI, 20G root, remainder home
maas admin partitions create <SYSID> <DEVID> size=536870912 bootable=true
maas admin partitions create <SYSID> <DEVID> size=$((20*1024*1024*1024))
maas admin partitions create <SYSID> <DEVID>

Filesystems and mount points

maas admin filesystem create <SYSID> <PARTID2> fstype=ext4 mount_point=/
maas admin filesystem create <SYSID> <PARTID3> fstype=ext4 mount_point=/home

Destructive operations

Storage commands can wipe disks. Be sure you are targeting the correct system and device.