Clearing state partition when using iPXE boot

I have botched up my state such that my rancher instance doesn’t boot into a console. I have no critical data and just want to re-do the PXE boot and have it format the state partition. I can’t seem to find the option to do this. It always seems to want to mount the state partition and try to use it instead of formatting it and starting with a fresh state.

Any tips/help in formatting the state partition would be appreciated! Or a way to launch maybe with no state?

On boot RancherOS will always try to mount a device labeled RANCHER_STATE first. You might want to start with an empty disk.

You can append rancher.state.formatzero=true rancher.state.autoformat=[/dev/sda,/dev/vda] to kernel params, but your disk should have (at least) 1MB (1048576 bytes) prefix of zero bytes to be considered for auto-formatting (that’s the reason for rancher.state.formatzero=true): we don’t want to wipe your data by accident.

Sorry, forgot to update this. I figured out how to do what I needed thanks to @ibuildthecloud

Adding the following to my kernel command line lets me start with no state.

rancher.state.dev=none

I created a menu entry in PXE for booting rancher with no state just incase I do something really bad and have to start over.

I appreciate that rancher doesn’t wipe by default and think that is an excellent choice/feature. In my case I needed a way to avoid loading the state and setting the bytes to 0 doesn’t cut it cause to do that I need to boot into an OS and rancher is the OS I wanted to boot.

1 Like