HeadlinesBriefing favicon HeadlinesBriefing.com

Linux Distro Install via `curl | dd` Explained

Hacker News •
×

An engineer detailed the process of installing a new Linux distribution directly to a disk using a network stream, essentially replicating the old `curl | sh` debate with disk imaging. This method leverages the Unix philosophy that everything, including block devices like /dev/sda, is a file, allowing direct redirection of data from standard input to the target drive.

Initially conceived as a way to avoid paying for object storage, perhaps for a Contabo VPS, the technique evolved from the standard `wget` followed by `dd`. It progresses to piping the network stream directly into `dd`'s standard input, bypassing the need for any intermediate disk files entirely.

Attempting this overwrite on a live, running system proved predictably disastrous, causing a crash mid-write at 77.8% completion. The actual trick to making this work involves booting from a separate rescue image, such as a standard Arch or NixOS installer, ensuring the target disk remains unmounted during the direct network write operation.

Building the source image itself can be automated using tools like QEMU for custom installations or leveraging NixOS's declarative capabilities via `make-disk-image.nix`. This showcases an extreme, if somewhat reckless, application of shell piping for system deployment.