curl > /dev/sda: Building a Linux Distro That Boots from wget | dd
From Shitpost to Operating System
What started as a joke riffing on the eternal "curl | sh" debate evolved into a four-part blog series about building a complete Linux distribution that can be installed by piping a network stream directly to a disk device.
The core command is deceptively simple:
curl https://something.example/foo.img > /dev/sda
This works because Unix treats everything as a file — /dev/sdX and /dev/nvmeX can be directly written to from the filesystem. Even more surprisingly, it works for most EFI machines without any efibootmgr commands because EFI firmware automatically discovers the new EFI system partition.
The Original Motivation
The author didn't want to pay Contabo an extra $1.50/month for object storage to spawn VPSes from premade disk images. "I thought it was a neat trick, a funny shitpost," they write. "The problem is that it didn't stop there. I kept asking one more question. I kept peeling one more layer off the onion."
The Technical Journey
The blog traces the evolution from the classic Raspberry Pi flashing method through increasingly lazy approaches:
- Download image in browser → use
ddto write to SD card - Use
wgetto download →ddto write - Pipe
curldirectly intodd(no intermediate file) - Skip
ddentirely:curl > /dev/sdx
Then comes the hard part: making your own bootable OS image using NixOS, configured to work with this streaming approach. The challenges include:
- Handling compressed images (
.img.gz+gunzip) - Making the system bootable via EFI without manual configuration
- Creating a minimal reproducible OS image with Nix
- Streaming the image over SSH to remote servers
Why It Matters
Beyond the humor, this project demonstrates fundamental Unix/Linux concepts in an accessible way: device files, pipe semantics, EFI boot discovery, and NixOS's declarative configuration system. It's also a practical approach for anyone managing large fleets of VPSes who wants to avoid cloud provider storage fees for custom images.
The four-part series covers everything from first principles to production deployment, making it both educational and genuinely useful.