Issue with Custrom Storage Configuration in MAAS: "Cannot Place Filesystem on the Boot Disk" Error

Hello everyone,

I am trying to set up a custom storage configuration for a machine in MAAS, following the guide provided here: How to create custom storage.

I created the following commissioning script:

#!/usr/bin/env python3
#
# 41-custom-storage-cluster-k8s-partitioned-2
#
# --- Start MAAS 1.0 script metadata ---
# name: 41-custom-storage-cluster-k8s-partitioned-2
# title: Configure custom storage for k8s cluster
# description: Configure custom storage for k8s cluster
# script_type: commissioning
# timeout: 60
# --- End MAAS 1.0 script metadata ---

import json
import os
import sys

def read_json_file(path):
    try:
        with open(path) as fd:
            return json.load(fd)
    except OSError as e:
        sys.exit(f"Failed to read {path}: {e}")
    except json.JSONDecodeError as e:
        sys.exit(f"Failed to parse {path}: {e}")

def main():
    maas_resources_file = os.environ.get("MAAS_RESOURCES_FILE")
    maas_storage_config_file = os.environ.get("MAAS_STORAGE_CONFIG_FILE")
    machine_resources = read_json_file(maas_resources_file)

    storage_config = {
        "layout": {
            "raid_root": {
                "type": "raid",
                "level": 1,
                "members": [
                    "nvme0n1",
                    "nvme1n1"
                ]
            },
            "lvm": {
              "type": "lvm",
              "members": [
                "raid_root"
              ],
              "volumes": [
                {
                  "name": "root",
                  "size": "800G",
                  "fs": "ext4"
                }
              ]
            }
        },
        "mounts": {
            "/": {
                "device": "root"
              }
            }
        }

    with open(maas_storage_config_file, "w") as f:
        json.dump(storage_config, f, indent=4, sort_keys=True)

    print(f"Custom storage configuration has been written to {maas_storage_config_file}")

    return 0

if __name__ == "__main__":
    sys.exit(main())

However, when I commission the machine, I receive the following error in the MAAS GUI:

image

Despite this error, the machine is marked as “Ready” in MAAS.

Could someone guide me on how to modify my script to ensure that the boot disks are properly configured?

Any insights or suggestions would be greatly appreciated!

Thank you!

It seems that the OS running at the commissioning stage is an ephemeral system based on the Squashfs (read-only filesystem).

If you wanna customise the storage layout, you can do it at the Web GUI under the “Storage” tab before deployment.

Thanks for the response.

Let’s say that after commissioning script named 41-custom-storage-cluster-k8s-partitioned-2 the machine is marked as “Ready” in MAAS.

After that, as you said, I go to Storage > Change storage layout > Custom.

When I select “Custom,” MAAS should apply the storage configuration defined in my 41-custom-storage-cluster-k8s-partitioned-2 script, correct?

However, I’m still receiving the following error:

How is this possible? Any insights would be greatly appreciated.

Thanks!

Using the GPT partition it works:

storage_config = {
  "layout": {
    "nvme0n1": {
      "type": "disk",
      "ptable": "gpt",
      "boot": True,
      "partitions": [
        {
          "name": "nvme0n11",
          "fs": "vfat",
          "size": "2G",
          "bootable": True
        },
        {
          "name": "nvme0n12",
          "size": "750G",
          "fs": "ext4"
        }
      ]
    },
    "storage": {
      "type": "raid",
      "level": 5,
      "members": [
        "sda",
        "sdb",
        "nvme2n1",
        "nvme3n1"
      ],
      "fs": "ext4"
    }
  },
  "mounts": {
    "/boot/efi": {
      "device": "nvme0n11"
    },
    "/": {
      "device": "nvme0n12"
    },
    "/var": {
      "device": "storage"
    }
  }
}

But I cannot use the LVM on top of RAID, i receive the same error I have shared:

    storage_config = {
      "layout": {
        "raid_root": {
            "type": "raid",
            "level": 1,
            "members": [
                "nvme0n1",
                "nvme1n1"
            ]
        },
        "storage": {
            "type": "raid",
            "level": 5,
            "members": [
                "sda",
                "sdb",
                "nvme2n1",
                "nvme3n1"
            ],
            "fs": "ext4"
        },
      "lvm": {
            "type": "lvm",
            "members": [
                "raid_root"
            ],
            "volumes": [
                {
                    "name": "boot",
                    "fs": "vfat",
                    "size": "2G"
                },
                {
                    "name": "root",
                    "size": "750G",
                    "fs": "ext4"
                }
            ]
        }
      },
      "mounts": {
        "/boot/efi": {
          "device": "boot"
        },
        "/": {
          "device": "root"
        },
        "/var": {
          "device": "storage"
        }
      }
    }

any advice?

Sorry, I don’t have any ideas. Let’s see more comments from the community.

1 Like