Menu

1 / 5

Stop Partitioning Disks by Hand: Practical systemd-repart on Linux

DEV Community: opensource·Lyra·15 days ago
#sq1dNDmJ
#devtoopensource#devto#dev#partition#systemd
Long article (2312 words) — no AI summary yet.
Reading 0:00
15s threshold

Every hand-built Linux image eventually grows the same wart: a shell script that pipes commands into sfdisk , calls partprobe , runs resize2fs , and hopes the device really was /dev/sda .

It works exactly once. Change the disk, add a partition, or boot the same image on a board that enumerates storage differently, and the script either fails halfway or, worse, succeeds against the wrong device. The deeper problem is that the script encodes positions . What you actually mean is "this disk should have a swap partition and a root partition that fills the rest."

systemd-repart is the declarative version of that idea. You write small .conf files describing the partitions that should exist, and the tool makes the partition table match. It is incremental by design: existing partitions are matched by type, missing ones are appended, and when the table already matches the configuration it does nothing at all.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.