Can I create partition on OS disk in fedora coreos

Hi Team,

I am newbie to fedora coreos, just have two queries.

  1. Is it possible to create partition on OS disk in fedora coreos (like normal Linux) with ignition file? I tried it, but every time it fails with error inappropriate ioctl with device. If it is possible, please point me to some documentation link.

  2. Is it possible to write fedora coreos on two disk in raid 1 configuration. I have two disk on server can both be used for OS setup in raid 1 configuration

Thanks in advance, It would be great if somebody can point me in right direction.

BR

Amit Bondwal

  1. The Example for adding a /var partition to the primary disk should help you here.
  2. I’m not 100% sure that this is available in a stable release yet, but this is coming. I’ll update this once I have a better answer.

Hi @Siosm, Thanks for your reply. I tried a lot of options, I not able to get it run after reboot while creating partition on the OS disk.

Please find my ignition yml file on pastebin

I tried disk name with /dev/sda as well with /dev/disk/by-id/xxxx. Result was always same.

What wrong, I am doing in this.


BR

Amit Bondwal

To add a partition to an existing disk, you don’t want to wipe and recreate all partitions (that will not work as all content will be lost) but instead keep the existing one and only add the one you want. See this example:

variant: fcos
version: 1.1.0
storage:
  disks:
  -
    # The name of the primary block device. In virtio-based setups, this is
    # likely `/dev/vda`. Elsewhere, it's likely `/dev/sda`.
    device: /dev/vda
    # We do not want to wipe the partition table since this is the primary
    # device.
    wipe_table: false
    partitions:
    - size_mib: 0
      # Start at 5G so that we leave enough space for the root partition.
      start_mib: 5000
      # 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
  filesystems:
    - path: /var
      device: /dev/disk/by-partlabel/var
      format: xfs
      with_mount_unit: true

For your second question, RAID 1 support for root is coming in the next stable release which should be available next week. In the meantime you can test this with testing and the example in this docs PR: https://github.com/coreos/fedora-coreos-docs/pull/178

Hi @Siosm, Thank you very much for this detailed reply. It worked like charm. I was thinking, it should work like a normal linux, in case of partition. But I am surprised to see this way, it is working. Even documentation not saying anything about this, how it works.

I will test the raid 1 too with testing iso soon.

So what I understand, we can’t change in main partitions manually like sysroot, boot, boot/efi. It should be as it is, it took space automatically, what is left.

It would be great help, if you could share some documentation link from which I could learn more of internals (basically to do thing manually to understand better fedora coreos). What are difference between normal linux and fedora coreos (in case of internal usability)

I will update you once I am done with raid1 testing too. Thanks again.


BR

Amit Bondwal

There is an in-progress PR to explain that: https://github.com/coreos/fedora-coreos-docs/pull/8
In short, you can only use separated partitions for /var and all sub directories. “Everything else” is managed by rpm-ostree.

Hi @Siosm, sorry for late response. I tried to install new fcos on a vm with two disk with raid1.
below one is my content of file.


 storage:
   disks:
   -
     device: /dev/sda
     wipe_table: true
     partitions:
     - label: foo
 
   -
     device: /dev/sdb
     wipe_table: true
     partitions:
     - label: bar
   raid:
     - name: myroot
       level: raid1
       devices:
       - /dev/disk/by-partlabel/foo
       - /dev/disk/by-partlabel/bar
 
   filesystems:
     -
       device: /dev/md/myroot
       format: ext4
       wipe_filesystem: true
       label: root

    My ignition file is this.

{"ignition":{"version":"3.1.0"},"passwd":{"users":[{"name":"core","passwordHash":"$1$core$5aXXhoTQK2Rg89MGKrHAl1","sshAuthorizedKeys":["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSNZn3WDvVg1ZdtTOhn1lHkUGfAsaoiTufMULduM804oc62dwgnnryfB1z9YZ5NUtMQdJANu5dc0+UaxLxrvKkVct6N903IjnsEh6l8JIUcFxpExVZBUEOAQ4Gl2dN44OVH1rdjXBJxgWc/+o3kCvOkUmQzjHpp7C0S0HJfZcvEzaIyho4+RrqNjaQw/xiiaKbo6hbnq02JWeZuy8SaUAzZG1uo2I/5KOKi9vlhOuhXS1lrbFWQ5IJN0g9iaz5I01zCxO/AC2ETHA4GN7CqFAG/H/sfW1eht8py6R/s4b4wVLMOPzn5G4sF3y2p+puoBfO0PuPVwWdx4le7iefOc8d amit@bondwal"]}]},"storage":{"disks":[{"device":"/dev/sda","partitions":[{"label":"foo"}],"wipeTable":true},{"device":"/dev/sdb","partitions":[{"label":"bar"}],"wipeTable":true}],"filesystems":[{"device":"/dev/md/myroot","format":"ext4","label":"root","wipeFilesystem":true}],"raid":[{"devices":["/dev/disk/by-partlabel/foo","/dev/disk/by-partlabel/bar"],"level":"raid1","name":"myroot"}]}}

One more doubt, how to run this ignition file in fcos after boot with lived cd.
In normal case I use this command,
coreos-installer install /dev/sda -i ignition-file-name.ign

but here is two disk with raid. so which device name should be pass with above command. please correct me what I am doing wrong here.


BR

Amit Bondwal

From https://github.com/coreos/fedora-coreos-docs/pull/178, I think you should use something like:

storage:
  raid:
    - name: myroot
      level: raid1
      devices:
      - /dev/disk/by-id/virtio-disk1
      - /dev/disk/by-id/virtio-disk2
  filesystems:
    - device: /dev/md/myroot
      format: ext4
      wipe_filesystem: true
      label: root

You should specify the disk on which you want to EFI & boot partition to be located as I don’t think that those can currently be part of a RAID1 array.

Edited to fix device paths.

will this work, if i want to:

  1. set /sysroot to around 30gb
  2. leave the rest as a different partition (sda1) named “diskdrive”

My setup is FCOS on bare metal with Kubernetes. I am somewhat reluctant due to space, since K8s may need space on /sysroot for logs and other data…
How many partitions can we have created at boot?

/ is mostly /usr and /etc (mounted as /sysroot on a running system) and should not keep any data. Everything else will be in /var that you can place on another disk or partition. You need approximately 5GiB for /, everything else can be for /var: https://docs.fedoraproject.org/en-US/fedora-coreos/storage/#_setting_up_separate_var_mounts