Skip to content

Commit 2a4634d

Browse files
committed
add howto to repair nixos installations
1 parent 16b035e commit 2a4634d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/howtos/INDEX.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
[Using your own kexec image](./custom-kexec.md)
1414

15+
[Repair installations without wiping data](./disko-modes.md)
16+
1517
[Secrets and full disk encryption](./secrets.md)
1618

1719
[Use without flakes](./use-without-flakes.md)

docs/howtos/disko-modes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Repair installations without wiping data
2+
3+
By default, nixos-anywhere will reformat all configured disks before running the installation.
4+
However it is also possible to mount the filesystems of an existing installation and run `nixos-install`.
5+
This is useful to recover from a mis-configured NixOS installation by first booting into a NixOS installer or recovery system.
6+
7+
To only mount existing filesystems, add `--disko-mode mount` to `nixos-anywhere`:
8+
9+
```
10+
nix run github:nix-community/nixos-anywhere -- --disko-mode mount --flake <path to configuration>#<configuration name> root@<ip address>
11+
```
12+
13+
1. This will first boot into a nixos-installer
14+
2. Mounts disks with disko
15+
3. Runs nixos-install based on the provided flake
16+
4. Reboots the machine.

0 commit comments

Comments
 (0)