Skip to content

Commit 44c8dfb

Browse files
committed
add howto to repair nixos installations
1 parent 16b035e commit 44c8dfb

File tree

2 files changed

+21
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)