synology-nas
Use this skill for ANY task on a Synology NAS via the mcp-server-synology MCP — managing files and folders on the NAS, searching…
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
Claude Code
$ npx -y skills add atom2ueki/mcp-server-synology --skill synology-recovery --agent claude-code
Codex
$ npx skills add atom2ueki/mcp-server-synology --skill synology-recovery -a codex -y
Cursor
$ npx skills add atom2ueki/mcp-server-synology --skill synology-recovery -a cursor -y
Gemini CLI
$ npx skills add atom2ueki/mcp-server-synology --skill synology-recovery -a gemini-cli -y
GitHub Copilot
$ npx skills add atom2ueki/mcp-server-synology --skill synology-recovery -a github-copilot -y
OpenCode
$ npx skills add atom2ueki/mcp-server-synology --skill synology-recovery -a opencode -y
Windsurf
$ npx skills add atom2ueki/mcp-server-synology --skill synology-recovery -a windsurf -y
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.
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.
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**.
`<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.
`<share>/#recycle/<path>`. The MCP's `list_directory` on `#recycle` answers error 408 when the bin does not exist.
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.
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:
user data was lost — stop, and look elsewhere.
conversion, a re-upload) must not be restored: check the names against recent work before copying. A blanket restore resurrects deleted-but-intended files.
case this skill is for.
Size the job with the same paths:
sudo du -sh --apparent-size "$S/<subpath>"
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"
pA Model Context Protocol (MCP) server for Synology NAS devices. Enables AI assistants to manage files and downloads through secure authentication and session management.
Use this skill for ANY task on a Synology NAS via the mcp-server-synology MCP — managing files and folders on the NAS, searching…
Use when the user needs to run GitNexus CLI commands like analyze/index a repo, check status, clean the index, generate a wiki,…
Query and invoke tools on MCP servers using fastmcp list and fastmcp call. Use when you need to discover what tools a server…
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain,…
小红书内容发布技能。支持两种发布模式:(1) 上传图文模式 - 图片+短文;(2) 写长文模式 - 长篇文章+排版模板。 支持两种输入方式:用户提供完整内容和图片/图片URL,直接发布;或提供网页URL,自动提取内容和图片。…