Skip to content

Commit

Permalink
add howto to repair nixos installations
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Sep 27, 2024
1 parent 16b035e commit 44c8dfb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/howtos/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

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

[Repair installations without wiping data](./disko-modes.md)

[Secrets and full disk encryption](./secrets.md)

[Use without flakes](./use-without-flakes.md)
Expand Down
19 changes: 19 additions & 0 deletions docs/howtos/disko-modes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Repair installations without wiping data

By default, nixos-anywhere will reformat all configured disks before running the
installation. However it is also possible to mount the filesystems of an
existing installation and run `nixos-install`. This is useful to recover from a
mis-configured NixOS installation by first booting into a NixOS installer or
recovery system.

To only mount existing filesystems, add `--disko-mode mount` to
`nixos-anywhere`:

```
nix run github:nix-community/nixos-anywhere -- --disko-mode mount --flake <path to configuration>#<configuration name> root@<ip address>
```

1. This will first boot into a nixos-installer
2. Mounts disks with disko
3. Runs nixos-install based on the provided flake
4. Reboots the machine.

0 comments on commit 44c8dfb

Please sign in to comment.