Strip mediaserver hardware config for new server migration

Clear old disk UUIDs, boot config, and filesystem mounts.
Add backup script for migrating service state to new hardware.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ediblerope 2026-04-14 15:33:07 +01:00
parent 570d0aadac
commit b06b2b04e3
2 changed files with 42 additions and 57 deletions

41
backup-server.sh Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
BACKUP_DIR="/mnt/disk4/server-backup-$(date +%Y%m%d)"
echo "Backing up to: $BACKUP_DIR"
mkdir -p "$BACKUP_DIR"
# Stop services first to get clean copies
echo "Stopping services..."
sudo systemctl stop jellyfin sonarr radarr prowlarr bazarr qbittorrent-nox authelia-main 2>/dev/null || true
sleep 3
# Service databases and config
for dir in jellyfin sonarr radarr prowlarr bazarr qbittorrent authelia-main; do
if [ -d "/var/lib/$dir" ]; then
echo "Backing up /var/lib/$dir ..."
sudo mkdir -p "$BACKUP_DIR/var-lib/$dir"
sudo rsync -a "/var/lib/$dir/" "$BACKUP_DIR/var-lib/$dir/"
else
echo "Skipping /var/lib/$dir (not found)"
fi
done
# Secrets
if [ -d "/var/secrets" ]; then
echo "Backing up /var/secrets ..."
sudo mkdir -p "$BACKUP_DIR/var-secrets"
sudo rsync -a "/var/secrets/" "$BACKUP_DIR/var-secrets/"
else
echo "Skipping /var/secrets (not found)"
fi
echo ""
echo "Backup complete: $BACKUP_DIR"
echo ""
echo "Size: $(sudo du -sh "$BACKUP_DIR" | cut -f1)"
echo ""
echo "NOTE: Media files on /mnt/storage are NOT included — move the data disks to the new server directly."
echo ""
echo "Restarting services..."
sudo systemctl start jellyfin sonarr radarr prowlarr bazarr qbittorrent-nox authelia-main 2>/dev/null || true

View file

@ -1,67 +1,11 @@
#./hosts/hardware/FredOS-Mediaserver.nix #./hosts/hardware/FredOS-Mediaserver.nix
# TODO: Replace with hardware-configuration.nix from new server
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "uhci_hcd" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/6008e793-4b24-4e62-821f-7a204fef5729";
fsType = "ext4";
};
# Individual Data Disks
fileSystems."/mnt/disk1" = {
device = "/dev/disk/by-uuid/90ae3493-38c1-4473-b409-e9d99c3b315e";
fsType = "ext4";
};
fileSystems."/mnt/disk2" = {
device = "/dev/disk/by-uuid/7145223e-f285-424a-a114-cb0b1b64e068";
fsType = "ext4";
};
fileSystems."/mnt/disk3" = {
device = "/dev/disk/by-uuid/58cecfd5-2fd7-4c4b-b3a1-0bf5e9d0beab";
fsType = "ext4";
};
fileSystems."/mnt/disk4" = {
device = "/dev/disk/by-uuid/317660ef-bd75-4fa4-bd20-f96a3926bf7b";
fsType = "ext4";
};
# The Combined MergerFS Pool
fileSystems."/mnt/storage" = {
device = "/mnt/disk1:/mnt/disk2:/mnt/disk3:/mnt/disk4";
fsType = "fuse.mergerfs";
options = [
"defaults"
"allow_other"
"use_ino"
"cache.files=partial"
"dropcacheonclose=true"
"category.create=mfs"
];
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
networking.hostName = "FredOS-Mediaserver"; networking.hostName = "FredOS-Mediaserver";
boot.loader.grub = {
enable = true;
# Includes all 4 physical disks for redundancy
devices = [ "/dev/sda" "/dev/sdb" "/dev/sdc" "/dev/sdd" "/dev/sde" ];
useOSProber = true;
};
system.stateVersion = "25.11"; system.stateVersion = "25.11";
} }