server-desktop-01/docs/synology.md

133 lines
3.8 KiB
Markdown

# Synology DS218plus
Operational notes for accessing and navigating the Synology NAS without rediscovering paths.
## Connection
- SSH config alias: `synology`
- Hostname/IP: `192.168.86.31`
- SSH user: `jared`
- SSH key from `~/.ssh/config`: `~/.ssh/id_ed25519_git`
- Verified NAS hostname: `DS218plus`
Quick check:
```bash
ssh synology 'hostname; id'
```
Expected identity:
```text
DS218plus
uid=1026(jared) gid=100(users) groups=100(users),101(administrators),65536(family)
```
## Volume Paths
**SSH and SFTP use completely different namespaces.** Do not mix them up.
**SSH shell** (`ssh synology`): home is `/var/services/homes/jared` (symlink to `/volume1/homes/jared`). Volume-level paths like `/volume1/...` are accessible.
**SFTP / restic**: shared folders appear directly under `/` as a virtual root. `/volume1` does not exist in SFTP space.
```bash
# SFTP root listing
sftp synology <<'EOF'
ls /
EOF
# → archive backup home homes music proxmox_backup
```
Active restic repo (SFTP path):
| Purpose | SFTP path |
| --- | --- |
| Fedora restic repo | `/homes/jared/Backups/fedora-workstation` |
Active restic repo (SSH path, for manual inspection):
| Purpose | SSH path |
| --- | --- |
| Fedora restic repo | `~/Backups/fedora-workstation` = `/volume1/homes/jared/Backups/fedora-workstation` |
## Restic Access
Local `restic` is installed at `/usr/bin/restic`. Credentials are sourced from `~/.credentials`; do not print the file or password.
The active backup script uses:
```bash
source ~/.credentials
restic -r "sftp:${SYNOLOGY_HOST}:${SYNOLOGY_PATH}" snapshots --compact
```
As of 2026-06-05, `~/.credentials` has:
```text
SYNOLOGY_HOST=synology
SYNOLOGY_PATH=/homes/jared/Backups/fedora-workstation
```
The leading path segment `homes` is the Synology shared folder name (visible in DSM), not a filesystem path. `/volume1/homes/...` is the SSH/filesystem equivalent but does not exist in SFTP space.
Repository structure:
```text
config
data/
index/
keys/
locks/
snapshots/
```
## Useful Restic Commands
List snapshots:
```bash
source ~/.credentials
restic -r "sftp:${SYNOLOGY_HOST}:${SYNOLOGY_PATH}" snapshots --compact
```
List a path in the latest snapshot:
```bash
source ~/.credentials
restic -r "sftp:${SYNOLOGY_HOST}:${SYNOLOGY_PATH}" ls latest /home/jared/.ssh
```
Search snapshots for specific files:
```bash
source ~/.credentials
restic -r "sftp:${SYNOLOGY_HOST}:${SYNOLOGY_PATH}" find /home/jared/.ssh/id_rsa /home/jared/.ssh/id_rsa.pub
```
Restore a specific file or directory to a temporary location:
```bash
source ~/.credentials
mkdir -p /tmp/restic-restore
restic -r "sftp:${SYNOLOGY_HOST}:${SYNOLOGY_PATH}" restore latest \
--target /tmp/restic-restore \
--include /home/jared/path/to/file
```
## Snapshot State on 2026-06-05
The Fedora restic repo was stalled since 2026-05-24 due to wrong SFTP path in `~/.credentials` (`/home/...` instead of `/homes/...`). Fixed 2026-06-05. Manual backup run confirmed new snapshot saved. Two stale locks were also cleared before the run.
Prior to fix, B2 had been running successfully every night; only Synology was affected.
## SSH Key Recovery Findings
Checked while investigating Hyperthrive VPS access on 2026-05-14:
- Latest restic snapshot `.ssh` contains only `config`, `id_ed25519_git`, `id_ed25519_git.pub`, `id_ed25519_ovh_backup`, `id_ed25519_ovh_backup.pub`, `known_hosts`, and `known_hosts.old`.
- `restic find` did not find `/home/jared/.ssh/id_rsa`, `/home/jared/.ssh/id_rsa.pub`, `id_ed25519_forgejo`, or `id_ed25519_forgejo.pub`.
- `/volume1/backup/jared_backup052124/.ssh` exists but is empty.
- `/volume1/backup/fedora_backup052124/jared/.ssh` exists but is empty.
- No `.ssh` files were found under `/volume1/backup/fedora_backup052124` or `/volume1/backup/fedora_recovery_oct2024` in the checked paths.