October 27, 2020

Partitions creation in Fedora CoreOS

Partitions creation in Fedora CoreOS

Fedora CoreOS works quite different than normal Linux in case of partitions of disk. It don't work in same way like normal Linux. We can create new partitions or mount new partitions under /var only or it's sub directory. We can't modify rest of the partitions except /var. We can't setup Fedora CoreOS in software Raid1 with two disk on server, like normal Linux works, /boot and /boot/efi not supported currently.

In this article we will create separate /var partition on the same disk on which OS will install. We have created below yml file.

variant: fcos
version: 1.0.0
    - name: core
      password_hash: "$1$core$5aXXhoTQK2Rg89MGKrHAl1"
        - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSNZn3WDvVg1ZdtTOhn1lHkUGfAsaoiTufMULduM804oc62dwgnnryfB1z9YZ5NUtMQdJANu5dc0+UaxLxrvKkVct6N903IjnsEh6l8JIUcFxpExVZBUEOAQ4Gl2dN44OVH1rdjXBJxgWc/+o3kCvOkUmQzjHpp7C0S0HJfZcvEzaIyho4+RrqNjaQw/xiiaKbo6hbnq02JWeZuy8SaUAzZG1uo2I/5KOKi9vlhOuhXS1lrbFWQ5IJN0g9iaz5I01zCxO/AC2ETHA4GN7CqFAG/H/sfW1eht8py6R/s4b4wVLMOPzn5G4sF3y2p+puoBfO0PuPVwWdx4le7iefOc8d amit@bondwal"

    # The name of the primary block device. In virtio-based setups, this is
    # likely `/dev/vda`. Elsewhere, it's likely `/dev/sda`.
    device: /dev/sda
    # We do not want to wipe the partition table since this is the primary
    # device.
    wipe_table: false
    - size_mib: 0
      start_mib: 8000
      # We assign a descriptive label to the partition. This is important
      # for referring to it in a device-agnostic way in other parts of the
      # configuration.
      label: var
    - path: /var
      device: /dev/disk/by-partlabel/var
      format: xfs
      # We need to create a systemd mount unit so that /var actually gets
      # mounted on /var.
      name: var.mount
      enabled: true
      contents: |

In the above yml file three things are important to understand.

  1. wipe_table : false, This is important we keep it false, otherwise it will clear the other partition (sysroot, boot etc.) which was created during this installation and installation will fail.
  2. size_mib=0 and start_mib=8000, here we are allocation disk starting from 0MB to 8000MB for  other partitions like boot, sysroot etc. rest of the disk will be assigned to /var partition. So, we should given sufficient space for sysroot and other partition. Here it was just testing setup so 8000MB was sufficient.  
  3. Disk should be clean, before running installation, disk should not have any partition, check disk with fdisk /dev/sdx before installation. If it any partition, delete these partition. Otherwise installation will fail.

To generate ignition file from yml file and installation, follow my previous article https://www.amitbondwal.com/fedora-coreos-installation-on-bare-metal/

If you want to embed comments, this is a good place to do it!