Is there a way to always keep a `busybox` in ram?

Last week, my machine experienced a hard drive disaster, during which any call to the executive files in /nix reported a i/o error.

I can do nothing but reboot my computer with a USB key to save my data.

Though finally my data are saved, I’m thinking is there a way always keep a busybox or some similar thing in ram in case next time a similar condition occurs.

Cool idea! You could make a tmpfs (which is backed by RAM) using systemd’s tempdir creation mechanisms at boot, and then add a unit that runs after this is created and copies busybox into it. Then mark the files as immutable so it isn’t accidentally overwritten.

Note that tmpfs can still be swapped out, so you’ll want to disable swap if you want to be resilient to hard drive failure. Or maybe this is the one use case where ramfs is better?

2 Likes