-
Notifications
You must be signed in to change notification settings - Fork 0
Disaster Recovery
Emily edited this page Mar 6, 2024
·
8 revisions
If shit hits the fan and the server is not responding to pings, there is little left to do. As you won't be able to rebuild the messed up configuration without ssh, so you will have to fire up the rescue console.
Once booted into the live system, it is best to enter a NixOS via the kexec method described in the ReadMe.
To restore your system you have two options:
- Boot a previous version of the system with
grub-reboot
- Mount the system and use
nixos-enter
tochroot
into the system and rebuild the config to your liking.
mkdir /boot
zpool import bpool
mount -t zfs bpool/nixos/root /boot
- Find a Grub Entry by checking the
/boot/grub/grub.cfg
file formenuentry
grub-reboot "<menuentry>"
reboot
- If you are using an encrypted root, decrypt every drive in the
rpool
:cryptsetup luksOpen /dev/disk/by-id/<name>-part3 luks-rpool-<name>-part3
- Import all pools:
zpool import -a
- Check that all pool have been successfully imported by executing
zpool list
- Mount all volumes according to
NixDotfiles/modules/boot/default.nix
(zfs-root.fileSystems.datasets
):
mount -t zfs rpool/nixos/root /mnt
mount -t zfs bpool/nixos/root /mnt/boot
mount -t zfs rpool/nixos/home /mnt/home
mount -t zfs rpool/nixos/var/lib /mnt/var/lib
mount -t zfs rpool/nixos/var/log /mnt/var/log
nixos-enter
- Edit the configuration to your liking
- Rebuild the system by executing
nixos-rebuild switch --flake .#ruwusch
with in theNixDotfiles
directory.