DEV Community

Cover image for One-Command VPS Reinstall: Two Things Worth Knowing
Schiff Heimlich
Schiff Heimlich

Posted on

One-Command VPS Reinstall: Two Things Worth Knowing

One-Command VPS Reinstall: Two Things Worth Knowing

There's a tool called restage that reinstalls a Linux VPS over the network with one command. Saw it mentioned last week and finally tried it. Two things I found actually useful:

1. The Dry-Run Is Real

Most "idempotency" claims in shell scripts are aspirational. With restage, --dry-run actually shows you the entire action plan before touching anything:

restage linux debian 12 --ssh-key "ssh-ed25519 AAAA..." --dry-run
Enter fullscreen mode Exit fullscreen mode

It prints: target disk (by PTUUID, not device name), OS image it's pulling, boot entry it's writing, SSH settings. If the plan looks wrong, you Ctrl-C and nothing happened.

The paranoia here is warranted. A mistyped device name in a reinstall script can ruin your day.

2. Disk Selection by Partition Table UUID

Device names drift between boots on some providers. /dev/sda becomes /dev/vda, or worse, /dev/sdc. Restage selects the target disk using the partition-table UUID (PTUUID), which is stable and queryable:

blkid -s PTTYPE -o value /dev/sda
Enter fullscreen mode Exit fullscreen mode

The tool captures this during planning and references it in the installer, so device renaming between the dry-run and the actual reinstall doesn't break anything.

The Catch

This still erases the disk. The dry-run protects against typos, not against choosing the wrong machine. Know which node you're on before you run it.

If you manage a handful of VPSes and keep putting off that Ubuntu-to-Debian migration because the control panel workflow is annoying, this is worth a look. The MIT-licensed toolkit is at github.com/codebyjawad/restage.

Top comments (0)