{
  "id": 5911972,
  "title": "Stop Hand-Partitioning Disks: Practical systemd-repart on Linux",
  "url": "https://urgent.news/2026/09/06/stop-hand-partitioning-disks-practical-systemd-repart-on-linux",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-06T05:02:50.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/lyraalishaikh/stop-hand-partitioning-disks-practical-systemd-repart-on-linux-58dp"
  },
  "original_language": "en",
  "account": "Stop Partitioning Disks Manually, Use systemd-repart for Linux\n\nSystemd-repart simplifies disk partitioning for minimal Linux OS images. The solution addresses challenges faced when shipping a minimal OS image to various targets, such as 64 GB, 256 GB, or 2 TB disks. Root remains at 8 GB, while swap is absent, and /home is not yet a partition. Instead of fragile installer hooks or one-off scripts, systemd-repart offers a declarative config using GPT definitions in repart.d/*.conf files.\n\nSystemd-repart operates on a block device or image file, adding missing partitions and growing existing ones to meet size/weight constraints. It is incremental and idempotent, meaning it does nothing if the table matches the config. By default, it only changes the partition table, unless you set specific options like Format, CopyFiles, CopyBlocks, Encrypt, or Verity.\n\nThe tool works on GPT disks, ignoring MBR. Partitions are matched by GPT type UUID, not by partition number. Filenames determine the definition order. Once a partition type is found, the corresponding config is used for that partition.\n\nThree jobs are involved: first-boot disk takeover, offline image build, and safe preview. The first-boot disk takeover is done using systemd-repart.service in initrd, while offline image build uses systemd-repart --image=... / --empty=create. Filesystem growth is a separate concern, requiring a GPT flag and systemd-growfs command.\n\nPrerequisites for using systemd-repart include a GPT disk or a new GPT image. The package is available as systemd-repart for Debian/Ubuntu, and root is required for real devices. Unprivileged builds can use loop files and userns. Ensure there is enough free space after the last partition you care about.\n\nTo build a minimal GPT image without touching real disks, create a sparse file, declare ESP + root + swap, format them, and inspect the result. Drop partition definitions under a dedicated definitions directory, and run systemd-repart with various parameters to simulate disk growth and preview changes before applying them.",
  "summary": "Stop Hand-Partitioning Disks: Practical systemd-repart on Linux You ship a minimal OS image. The target disk is 64 GB, 256 GB, or 2 TB. Root is still 8 GB. Swap does not exist. /home is not a partition yet. The usual fix is a one-off parted / gdisk script, a fragile installer hook, or “remember to resize after first boot.” That does not scale across VMs, bare metal, and image-based fleets.…",
  "key_points": [
    "systemd-repart simplifies disk partitioning for Linux OS images",
    "Configurations defined in repart.d/.conf files, no fragile installer hooks",
    "Incremental and idempotent tool, operates on GPT disks"
  ],
  "editors_take": "Systemd-repart's declarative approach to disk partitioning streamlines Linux OS image deployment across varied disk sizes, replacing manual or script-based methods with a more robust and flexible solution.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}