> How do you unmount your OS’s disk while keeping the OS running to be able to overwrite itself? I went down a similar rabbit-hole myself, with the goal of safely replacing the Linux installation on a disk that a machine is already running from (e.g. replace a VPS's setup image with one of your own) without needing a KVM-style remote access tool to the console. The problem there is if you directly modify the disk whe…
curl > /dev/sda: How I made a Linux distro that runs wget | dd
21–30 of 70 posts
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#22Earlier quoted context omitted.
What if we remount the filesystem(s) at /dev/sda as read-only first? Then make a small ramfs with statically-linked curl in it and exec it. Hmm. Ideally, you'd also want to call reboot(2) after it's done...
All of those things get covered in parts 2, 3, and 4 :)
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#23Earlier quoted context omitted.
All of those things get covered in parts 2, 3, and 4 :)
There's... no part 2 in the post? And it's the latest blog post on the site, as far as I can see.
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#24QEMU defaults to 512B sectors, which isn't true for many NVMe drives. There are some flags to change that. https://unix.stackexchange.com/a/722450
I think it should be possible to make an image with many headers at different locations, so that it works on all types of disks at once, but I don't think any tools do it for you by default.
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#25Earlier quoted context omitted.
There's... no part 2 in the post? And it's the latest blog post on the site, as far as I can see.
It does get linked at the very bottom, though admittedly it could be made clearer. https://astrid.tech/2026/03/24/1/swap-out-the-root-before-bo...
On the topic itself: wow, what a journey. And I personally fully support "come on, you should totally be able to just dump the system image onto your disk and reboot/exec it!"
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#26Unfortunately it's not safe as the kernel can still write to (what it thinks is) the old filesystem on the device, which will introduce corruption to the new disk image. However a fun fact is that you can (do not actually do this!) boot a qemu VM from /dev/sda. You have to use an overlay (eg. qemu -drive snapshot=on flag) so that qemu won't write through to /dev/sda. I use this trick in supernested, a script I wrote…
[0]: https://www.man7.org/linux/man-pages/man8/xfs_freeze.8.html
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#27Unfortunately it's not safe as the kernel can still write to (what it thinks is) the old filesystem on the device, which will introduce corruption to the new disk image. However a fun fact is that you can (do not actually do this!) boot a qemu VM from /dev/sda. You have to use an overlay (eg. qemu -drive snapshot=on flag) so that qemu won't write through to /dev/sda. I use this trick in supernested, a script I wrote…
Without spoiling too much, the command at the very end of the series does something adjacent to this.
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#28Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#29I've been dd-ing A/B partitions for embedded yocto distributions for years and years. read-only-rootfs (/var/log is its own writable partition), dd the "other partition", sed fstab, reboot. The neat part was the whole process kicked off when you scp'd the rootfs and inotifywait kicked off the whole process.
Re: curl > /dev/sda: How I made a Linux distro that runs wget | dd
#30Unfortunately it's not safe as the kernel can still write to (what it thinks is) the old filesystem on the device, which will introduce corruption to the new disk image. However a fun fact is that you can (do not actually do this!) boot a qemu VM from /dev/sda. You have to use an overlay (eg. qemu -drive snapshot=on flag) so that qemu won't write through to /dev/sda. I use this trick in supernested, a script I wrote…
It's not a real dual boot if you don't boot both partitions at the same time.
As long as you don't install guest VBox drivers, those would make it hang when it boots as the host on physical hardware, since there's no longer someone above to answer the hypercalls.