Skip to content
MCP Servers
Skill

/synology-recovery

Use this skill when files or folders on a Synology NAS have been deleted or overwritten and need to come back — accidental deletes, a runaway rm/rsync, a failed bulk move, a container that wiped a share, or an agent that deleted through a mounted SMB path. Covers Btrfs share

From plugin
mcp-server-synology
2592 skills

Claude Code

$ npx -y skills add atom2ueki/mcp-server-synology --skill synology-recovery --agent claude-code

SKILL.md

synology-recovery.SKILL.md
name: synology-recovery
description: Use this skill when files or folders on a Synology NAS have been deleted or overwritten and need to come back — accidental deletes, a runaway rm/rsync, a failed bulk move, a container that wiped a share, or an agent that deleted through a mounted SMB path. Covers Btrfs share snapshots (Snapshot Replication), snapshot diffing, missing-only restore with reflink clones, verification, and the stale-mount trap that makes a damaged share look emptier than it is. Triggers on "restore from snapshot", "recover deleted files", "undelete", "roll back a share", "accidental delete on the NAS", "rm -rf deleted my files", and "files missing from the NAS". Not for volume-level disasters (dead disk, failed RAID): use Synology's own restore or a backup product for those.

Synology snapshot recovery

Restore what was deleted, prove it with counts and checksums, and leave the share no worse than you found it. The whole procedure is read-only until one explicit copy step, so it is safe to run on a live NAS.

Before anything: measure twice

Two traps make a damaged share look worse — or better — than it is:

1. **Stale mounts.** A macOS SMB mount whose server-side handle is in a bad state returns contradictory listings (the same folder showed 12 files, then 774, then 1011). If the incident involved a mounted path, run `diskutil unmount force <mountpoint>` and remount before counting anything. Never inventory through a mount you do not trust. 2. **Snapshots are not the live share.** Read them from the NAS itself, not through SMB. Snapshot directories are root-only (`d---------`), so plain `ls` "proves" they are empty. Use `sudo`.

Also check the obvious first: **the MCP trash and the Recycle Bin**.

  • If the delete went through the MCP server's `delete` tool, look in

`<share>/#trash/<YYYY-MM-DD>/` first. The tool result reports `soft_delete: true` and `trash_path`, and the audit trail's `delete_placement` lines name the exact location. A file there is a plain move away from being restored — no snapshot needed. Use the recorded `original_path`, not a path inferred from the layout: basename collisions use a unique subdirectory. A custom trash location may also be configured.

  • If the share had DSM's Recycle Bin enabled, deleted files are in

`<share>/#recycle/<path>`. The MCP's `list_directory` on `#recycle` answers error 408 when the bin does not exist.

Step 1 — inventory the snapshots

Snapshots live under `/volume1/@sharesnap/<share>/` and are named by local time:

sudo ls /volume1/@sharesnap/<share>/
sudo /usr/syno/sbin/synosharesnapshot list <share>

Pick the **newest snapshot taken before the damage**. Read the timezone from each `GMT±HH-…` name; a daily schedule at 00:00 means the snapshot from the incident day contains the state from the start of that day.

If the newest snapshot is *after* the deletion, walk back one day at a time until the entry count matches what the user expects. Do not restore from a snapshot that already contains the loss.

Step 2 — diff before you copy

Counts first, then names. This is the step that tells you whether you are looking at 12 lost files or 2 TB.

S=/volume1/@sharesnap/<share>/<snapshot>
# file lists (paths are relative, so sort/comm line up)
sudo bash -c 'cd -- "$1" && find . -type f | sort' bash "$S" > /tmp/snap.txt
sudo bash -c 'cd -- "$1" && find . -type f | sort' bash "/volume1/<share>" > /tmp/live.txt
wc -l /tmp/snap.txt /tmp/live.txt
comm -23 /tmp/snap.txt /tmp/live.txt | wc -l   # missing from live
comm -23 /tmp/snap.txt /tmp/live.txt | head    # what exactly

Interpret before acting:

  • **Only Synology metadata differs** (`@eaDir/`, `SYNO@.fileindexdb`)? Then no

user data was lost — stop, and look elsewhere.

  • **Missing files that the user intentionally removed or renamed** (a

conversion, a re-upload) must not be restored: check the names against recent work before copying. A blanket restore resurrects deleted-but-intended files.

  • **Everything missing at once** points at a recursive delete, which is the

case this skill is for.

Size the job with the same paths:

sudo du -sh --apparent-size "$S/<subpath>"

Step 3 — restore missing-only, with reflink clones

On Btrfs a snapshot and its live share can support copy-on-write clones. Use `cp --reflink=always` to require a clone: an unsupported or cross-filesystem copy fails instead of silently allocating the full dataset. Clones share data blocks initially; metadata and later writes still consume space.

Restore **only what is missing**. Review the exact diff against the user's requested recovery scope before writing. Live files may be newer. Run while other agents and library jobs are not changing the affected paths. `-n` prevents clobbering an existing destination; reject symlink parents before copying.

S=/volume1/@sharesnap/<share>/<snapshot>
L=/volume1/<share>

# Validate the live destination and every existing parent before either pass.
check="$L/<subpath>"
while [ "$check" != / ]; do
  [ ! -L "$check" ] || { echo "symlink parent: $check" >&2; exit 1; }
  check=$(dirname "$check")
done
mkdir -p "$L/<subpath>" || exit 1

# Pass A: top-level entries that are gone entirely (preserves dir metadata,
# ownership and permissions, and clones every file inside in one go).
find "$S/<subpath>" -mindepth 1 -maxdepth 1 -print0 |
while IFS= read -r -d '' entry; do
  name=$(basename "$entry")
  [ -e "$L/<subpath>/$name" ] || [ -L "$L/<subpath>/$name" ] ||
    cp -an --reflink=always "$entry" "$L/<subpath>/" || exit 1
done

# Pass B: files missing inside directories that still exist (merge, never
# overwrite). -print0/read -d '' keeps CJK, spaces and emoji intact.
find "$S/<subpath>" -mindepth 1 -type f -print0 |
while IFS= read -r -d '' file; do
  rel="${file#"$S/<subpath>/"}"
  [ -e "$L/<subpath>/$rel" ] || [ -L "$L/<subpath>/$rel" ] || {
    destination="$L/<subpath>/$rel"
    p
Read more
@atom2ueki
Ships withmcp-server-synology

A Model Context Protocol (MCP) server for Synology NAS devices. Enables AI assistants to manage files and downloads through secure authentication and session management.

Stars on GitHub

Momentum

stars in total
259
Star history of atom2ueki/mcp-server-synology on GitHub, a chart by star-history.com

Other skills on mcp-server-synology.

More skills from other plugins.

gitnexus-cli

gitnexus-cli

Use when the user needs to run GitNexus CLI commands like analyze/index a repo, check status, clean the index, generate a wiki,…

gitnexus10d49k
@abhigyanpatwari@abhigyanpatwariInstall Skill
fastmcp-client-cli

fastmcp-client-cli

Query and invoke tools on MCP servers using fastmcp list and fastmcp call. Use when you need to discover what tools a server…

fastmcp9d29k
@prefecthq@prefecthqInstall Skill
n8n-agents

n8n-agents

Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain,…

n8n-mcp9d23k
@czlonkowski@czlonkowskiInstall Skill
post-to-xhs

post-to-xhs

小红书内容发布技能。支持两种发布模式:(1) 上传图文模式 - 图片+短文;(2) 写长文模式 - 长篇文章+排版模板。 支持两种输入方式:用户提供完整内容和图片/图片URL,直接发布;或提供网页URL,自动提取内容和图片。…

@xpzouying@xpzouyingInstall Skill

Questions about synology-recovery.

Which coding agents can use synology-recovery?
synology-recovery installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.