PartitionModel - ODEX-TOS/tos-installer-backend GitHub Wiki

A partition model is a model that defines a single partition inside a disk. Partitions are a submodel of a disk and can only be specified under the disk model.

It look like the following

models:
 - disks:
   - disk:
      - partition:
                name: "efi" 
                mount: "/boot/efi" 
                filesystem: "fat32" 
                start: "1MiB" 
                end: "200MiB"

A partition must have at least all these options provided

  • The name is the canonical name of the partition
  • The mount is the location in the new system where to mount the partition
  • The filesystem is the new filesystem that is on the partition
  • The start is the start location of the partition on the disk
  • The end is the end location of the partition on the disk

filesystem can be one of the following:

  • fat32 (efi partitions should be fat32)
  • swap (for swap partitions)
  • luks (for luks encrypted partitions)
  • ext4
  • btrfs

The start and end section of the partition are as parted describes the start/end of a partition. It can be in human readable format or in percentage

You can also resize a partition (only use this is your are altering an existing partitiontable) If you generate a new table you can't "resize" something

models:
 - disks:
   - disk:
      - partition:
                name: "efi" 
                mount: "/boot/efi" 
                filesystem: "fat32" 
                resize: true
                size: "100GB"

In the yaml above you can see that we don't need the start and the stop location. That is because we are altering an existing partition (because resize is true) and we can get the information from there. When resizing an existing partition you need to specify the new size. This accepts the same syntax as a start or end block

The following is an example of optional options

models:
   - disks:
       -disk:
           # disk information
           - partitions:
             partition:
                name: "root"
                mount: "/"
                filesystem: "luks"
                start: "8GiB"
                end: "100%"
                resize: true # only use this if altering an exisiting partition
                size: "100GB" # size must be specified if resizing and start,end are ignored
                offset: 8
                encrypted: True
                password: "your_password"
                logicvolumes:
                   # your logic volume
                 

If you use encryption these are the things you must do

  • encrypted must be set to True
  • a encryption password must be provided
  • filesystem must be luks
  • you must have logicvolumes setup

offset is a special parameter of a partition. This is the offset in a partitiontable. by default we calculate the value as the index of the array of partitions you have provided in the model. However when altering a partitiontable the generated value can be wrong. Thus you can specify your own offset this way we don't override existing partitions on a partitiontable