curl > dev/sda
84 points by abhin4v
84 points by abhin4v
A fun linux exercise is to take a running system, create a minimal root in a tmpfs, get the system to a state where you can pivot root to the tmpfs and then unmount the disk. It takes some finnagling but is quite doable by hand. Systemd supports a concept of a shutdown initrd which is essentially that.
Then you install Arch curl > /dev/sda.
https://github.com/marcan/takeover.sh or, I believe nix-infect.
It's https://github.com/nix-community/nixos-anywhere now!
I was definitely thinking about it while reading the article cause I set it up recently. It doesn't download directly to disk, but indeed does kexec into a downloaded NixOS with tools to format disks and install the new system config.
What's a lot nicer compared to curl > /dev/sda is the download is done on an already setup machine, so kernel & tool signatures are checked by nix.
This is what stage 1 gentoo was, I think? A very, very revealing and great teaching exercise. Live CD, get a system running in a temp dir, chroot into it. It is worth doing just once.
oh I did this about ten years ago to migrate an Arch install from one machine to another, and it worked!
I followed exactly the steps you describe, except used rsync for the last step :D
A fun linux exercise is to take a running system, create a minimal root in a tmpfs, get the system to a state where you can pivot root to the tmpfs and then unmount the disk. It takes some finnagling but is quite doable by hand. Systemd supports a concept of a shutdown initrd which is essentially that.
Isn't we can just flush and remount everything with ro, then dd?
I love this series. It's connecting a lot of Linux booting dots that I was missing. Note: the link to part 2 is in the bottom. I missed it initially
Things like this need more disclaimers. There are a bunch of people who don't understand the sarcasm and then suggest people do this on Reddit. Most of the search results for "how do I move my steam Deck to a new nvme drive" have this as the top voted answer and it's so frustrating.
There have been gists of better ways floating around for a while because Oracle free tier only allows Ubuntu: https://gist.github.com/4abhinavjain/893ec13c651bee08088c8f4661998952
I installed Debian on Oracle Cloud Free Tier in a different way. There's a debugging shell which allows you to jump into UEFI directly. From there you can just load netboot.xyz and install the distro you like
A much better way.
The way I settled on was to mount a new disk, dd the cloud image to it, reboot with it being the primary disk.
It was the only way I could get to reliabily work with hands totally off and terraform managing the state.
In case some people might’ve missed it, this is the first post in a 4 part series:
Part 0: this one
Part 1: https://astrid.tech/2026/03/24/1/swap-out-the-root-before-boot/
Part 2: https://astrid.tech/2026/03/24/2/how-to-pass-secrets-between-reboots/
Well this is a wild ride.
I actually tried to find out how to something like this relatively recently, when I wanted to repartition an Oracle Cloud boot disk to have a larger /boot partition. So the partition layout was /boot 100MB (way too small for NixOS), and then imediately after that, 99.9GB of ext4. I ended up growing the disk slightly, moving the ext4 partition forward, and then growing /boot, but it would have been incredibly nice if I could have done this without having to pay oracle for another boot drive while I did this!
curl | sudo tee /dev/sda
I thought that I had initramfs figured out until I had to roll my own. The author’s journey is pretty similar to the one I took!
I’ve had good luck using u-root in the past to boot Debian images via a TFTPed initrd that downloaded the large image via HTTP (since TFTP is slow). I had to tweak the u-root implementation of switch_root to add support for extra arguments (systemd init needed it IIRC).
ha, the way I had to install the postmarketOS rootfs onto my new phone was with nc -l 6969 > /dev/sdX12 over USB networking. The geniuses who worked on the bootloader decided that userdata should only be allowed to be erased from fastboot but not flashed with an image… and chainloaded U-Boot is (for now) useless as there's an issue breaking the UFS driver specifically with the combo of this SoC (kodiak/yupik) and UFS 3.x. So booting into debug-shell, starting the receiving netcat on the phone via telnet and the sending netcat on the PC was the easiest option left :)