Fixing Synology USB Copy's "Format Problem" for Good: My Own USB Copy (Kay Edition) That Beats the Original
Synology USB Copy loses its tasks when you format a memory card. I had Claude Code on my NAS build a replacement that detects DCIM, auto-sorts by date and ejects safely.

Contents20 items
In my previous post, I set up Claude Code to live permanently on my Synology NAS. An AI is now on standby inside the NAS, 24 hours a day.
Once that happens, humans start getting ideas.
“So, what should I have it build?”
This blog, a POS register and a bird-themed shooting game — I’ve been running all of them on the NAS. This time, too, I wanted the AI inside the NAS to build something that actually does work. When I looked around me with that in mind, what caught my eye was Synology’s own “USB Copy.”
Let me give you the conclusion up front: I ended up with something easier to use than the original.
The stock USB Copy is handy. But one thing drives me nuts#
First, to give credit where it’s due: Synology USB Copy is a great package.
When I get back from a day of bird photography, exhausted, with no energy left to even boot up my Mac — being able to just plug a card reader into the NAS and have it import everything on its own is genuinely valuable for one reason alone: you can back up without going through a PC. Turning the post-shoot “get it off the card for now” from a ritual into something automatic is a huge relief for my peace of mind.
But there’s one thing. Just one thing that really drives me nuts.
Once you format the memory card, the task you registered can no longer be triggered.
USB Copy 2.0 tasks are tied to the device’s registration info. Format the card, and it’s treated as a different device, so the task you so carefully set up no longer applies.
…I suspect everyone in the bird-photography crowd is nodding along right now. Formatting your cards matters, right?
Formatting in the camera body, not just deleting. To keep the card performing well and to prevent write errors, we do this after every shoot. In bird photography, where burst shooting really punishes your cards, it’s practically etiquette.
In other words, for me the stock USB Copy was “a tool you have to reconfigure every time you format your card.” It’s supposed to be automation, yet that one part was manual. That contradiction had been nagging at me for years.
Before that: how I import into Lightroom#
Before I get into the build, let me explain a basic premise: how I manage my photos. Without this, it won’t make sense why the script turned out the way it did.
I manage around 200,000 RAW files in a single Lightroom Classic catalog.
Here’s where it gets interesting: I change the import destination every time depending on the situation.
- When I’m out and want to edit quickly: import to the Mac’s internal SSD
- When there are lots of shots, like on a trip: import to an external SSD
- When I’m at home: import directly to the NAS
- When I’m out but only have a few shots: sometimes I drop them straight onto the NAS via Tailscale
It looks all over the place, but there’s one goal: everything ends up consolidated on the NAS.
The Mac’s internal drive and the external SSD are just temporary shelters; once the editing settles down, I use Lightroom’s “Move Folder” to bring things over to the NAS. And because I have Tailscale installed, I can open and edit RAW files on the NAS even when I’m out. Having a single mothership gives you that kind of freedom.
📎 Also worth reading: Editing in Lightroom from anywhere with Synology and Tailscale
And here’s the folder structure on the mothership side.
/volume1/homes/Kay/
└── Creatives/ ← where creative files live
└── Lightroom/
├── 2025/
│ ├── 2025-11-03/
│ └── 2025-11-14/
└── 2026/
├── 2026-07-19/
└── 2026-07-21/Creatives/Lightroom/YYYY/YYYY-MM-DD. An extremely straightforward structure based on the shooting date. I think it’s a structure you never get tired of no matter how many years you use it — and one that never breaks.
And my homemade USB Copy this time is simply this rule turned into a script. This is an important point, so I’ll come back to it later.
Design principle: stop using device IDs and just check “is there a DCIM folder?”#
Now, the build. I worked out the design by talking to the session on the NAS from the Claude app on my iPhone.
The main issue, of course, was how to get around the format problem.
The answer was simple: stop looking at device IDs.
The stock app identifies a card by “which device it is,” so formatting turns it into a stranger. So I decided to just check “whether the mounted USB has a DCIM folder.”
Camera memory cards always have a DCIM folder. It’s defined by the standard. Which means:
- Cards fresh out of a format: OK
- Brand-new cards you just bought: OK
- No pre-registration needed at all
I didn’t work around the problem; I made the problem disappear. This was the most satisfying design decision of the whole project.
On top of that, I set the following requirements.
- Import destination is
Creatives/Lightroom/YYYY/YYYY-MM-DD(shooting date = based on the file’s mtime) - Make it idempotent: skip files with the same name and same size. The result is the same no matter how many times you run it
- Treat size mismatches as “broken files” and re-copy them: automatically repairs half-finished files from interrupted transfers
- If there are zero new copies, stay completely silent and do nothing: it’s a task that runs every minute, so if it beeped every time it spun idle, my household would fall apart
- If even one file fails, no completion beep and no auto-eject: no sound = a sign that something happened. The card stays inserted so you can investigate later
That last one is unglamorous, but it’s actually the most important. The worst thing a backup tool can do is “look like it succeeded when it actually failed.”
Two kinds of triggers: automatic, or via chat#
This is where it sets itself apart from the original. The stock USB Copy is “plug it in and it runs automatically.” That part is perfect as is, so I kept it and made it callable from chat as well.
Trigger 1: runs automatically when you plug it in#
I registered a task that runs every minute in DSM’s Task Scheduler, which calls the main script. When you insert a card, it detects it and gets going within a minute at most.
Trigger 2: “Do a USB Copy” from my iPhone#
This is the new idea. From the Code tab in the Claude app on my iPhone, I say this to the session living on the NAS:
“Do a USB Copy”
Then this happens:
- Claude creates a “request file” in the
bridgefolder - A watcher task running every minute on the NAS side detects the file, deletes it and runs the main script
- Claude reads the execution log and reports back the count: “Copied N files”
Why such a roundabout approach? There’s a reason.
Claude, living inside a container, can’t directly touch the NAS’s USB devices or DSM commands. In my previous post I wrote that “you control what it can see through mounts,” and this is the flip side of that safety.
So I prepared just one folder that both sides can share and put a “request file” there. The NAS side checks that folder periodically. It’s like dropping a letter in the mailbox and having the mail carrier come by to collect it.
By the way, I wrote these instructions in the container’s global CLAUDE.md (/root/.claude/CLAUDE.md). A per-project CLAUDE.md would only work in that one session.
Until I realized this, I kept saying “Do a USB Copy” to the session I use for business-system development. Naturally, no response. I thought the AI was broken, but what was broken was my understanding.
The full script#
I’ve gone on at length, but this is all it really is.
#!/bin/bash
DEST=/volume1/homes/Kay/Creatives/Lightroom
LOG=/volume1/docker/claude/bridge/usb-eject.log
BEEP() { local n=$1; while [ $n -gt 0 ]; do echo 2 > /dev/ttyS1; sleep 1; n=$((n-1)); done; }
COPIED=0
FAILED=0
for MOUNT in /volumeUSB*/usbshare*; do
[ -d "$MOUNT/DCIM" ] || continue
TODO=()
while IFS= read -r f; do
d=$(date -r "$f" +%Y/%Y-%m-%d)
t="$DEST/$d/$(basename "$f")"
if [ ! -e "$t" ] || [ "$(stat -c%s "$f" 2>/dev/null)" != "$(stat -c%s "$t" 2>/dev/null)" ]; then
TODO+=("$f")
fi
done < <(find "$MOUNT/DCIM" -type f \
\( -iname '*.nef' -o -iname '*.jpg' -o -iname '*.jpeg' \
-o -iname '*.heif' -o -iname '*.hif' \
-o -iname '*.mov' -o -iname '*.mp4' \) )
[ ${#TODO[@]} -eq 0 ] && continue
BEEP 1
for f in "${TODO[@]}"; do
d=$(date -r "$f" +%Y/%Y-%m-%d)
mkdir -p "$DEST/$d"
if cp -p "$f" "$DEST/$d/"; then COPIED=$((COPIED+1)); else FAILED=$((FAILED+1)); fi
done
if [ "$FAILED" -eq 0 ]; then
BEEP 2
sync
BASE=$(grep -m1 " $MOUNT " /proc/mounts | awk '{print $1}' | sed 's|/dev/||; s|p[0-9]*$||')
/usr/syno/bin/synowebapi --exec api=SYNO.Core.ExternalDevice.Storage.USB \
method=eject version=1 dev_id="$BASE" >> "$LOG" 2>&1
fi
done
echo "copied: $COPIED files, failed: $FAILED"The fact that Nikon’s .nef is among the supported extensions is, well, exactly what you think. I included .hif (HEIF) too.
There are two tasks to register, both running as user root.
- Auto-detect task: runs
usb-import.shevery minute - Bridge watcher task: every minute, if there’s a request file, deletes it and runs
usb-import.shwith logging
⚠️ How the beep works, and the one number you must never get wrong#
For the completion notice, I went with a “beep” from the NAS’s built-in buzzer. Here’s how it works.
echo 2 > /dev/ttyS1Write 2 to /dev/ttyS1, and the built-in buzzer gives a short beep. Beautifully simple.
…But here comes a serious warning.
The reason I ended up with this notification method: at first I tried to use DSM’s notification feature by calling synodsmnotify, but it was rejected with the error neither mail string key nor i18n format. DSM 7 no longer allows free-text titles. I gave up gracefully and consolidated on beeps plus chat reports.
The auto-eject labyrinth: five stages of getting stuck#
Now for the highlight of this post.
What I wanted to do could be said in one sentence: “safely eject the card when the copy is done.”
…It took me an entire night.
Stage 1: a plain umount doesn’t release it#
First, a regular umount. The front-facing mount comes off. But the USB icon in DSM stays put.
The cause: on a NAS running Container Manager, USB shares are mirror-mounted under /volume1/@appdata/ContainerManager/all_shares/. Even after unmounting the front, it was still holding on to the device in the background.
A trap unique to NAS units with Docker installed. I’d like a word with the version of me from my previous post.
Stage 2: synousbdisk is just a husk now#
“There must be a DSM-specific command,” I thought, and went looking — and found synousbdisk.
-umountreturns succeeded but the UI still shows the device (in other words, it lies)-rmtabentrydoesn’t accept arguments/usr/syno/etc/usbtabdoesn’t even exist-enumusbdisksreturns nothing
It’s legacy in DSM 7. Most guides you’ll find online date from the DSM 6 era.
Stage 3: detaching at the kernel level#
echo 1 > /sys/block/usbX/device/deleteThis successfully detached it at the kernel level. The USB icon disappeared.
“I win.”
…Or so I thought, until I saw that only the usbshare1 folder was left behind in File Station. And when I tried to open it, I couldn’t access its contents. The device had been detached, but the empty “shell” of the shared folder was squatting there.
Stage 4: deleting the shared folder is refused#
Then I’ll just delete the shared folder, I thought — synoshare --del.
What came back was error 0xB500. usbshare is treated differently from regular shared folders, and deletion is refused.
That’s where I hit a complete dead end. At 2 a.m., staring at an empty shell of a folder that wouldn’t go away despite five stacked commands, I had the thought that turned things around: “What does the ‘Eject’ button in the DSM UI actually do, anyway?”
Stage 5: the answer was the Web API#
The DSM UI calls the Web API internally. And that API can be called directly from the CLI.
synowebapi --exec api=SYNO.Core.ExternalDevice.Storage.USB \
method=eject version=1 dev_id="usb3"One shot, and that was it.
Unmount, mirror release, USB icon, usbshare display — all of it disappeared at once.
The final version threw away all five stages of processing I’d built up and replaced them with this one line. What was that whole night for? Well, it’s precisely because I took the long way around that the lesson really sank in.
Other places I got stuck#
Besides the labyrinth, there were plenty of smaller pitfalls.
1. Task Scheduler traps, part 4
I set it to “every minute,” yet it never ran automatically. Running it manually worked. The culprit behind this symptom: “Last run time” was still at the default of 00:59.
In other words, it had become a task that only runs during the 12 a.m. hour each day. Changing it to 23:59 fixed it. Always check the repeat interval and the last run time together.
2. A missing bridge mount creates a “fake folder”
I’d forgotten to add the bridge folder mount to compose.yaml, so Claude went ahead and created a new folder with the same name inside the container.
The request file gets created just fine. The log says success. But it never reaches the NAS side, ever. A bug that looks like it’s working fine at first glance is the nastiest kind.
3. Just adding to CLAUDE.md doesn’t take effect
CLAUDE.md is loaded when a session starts. After adding to it, it won’t take effect until you run /clear.
The finished experience#
That was a long road. So here’s how the final version feels to use.
Plug in the card reader ↓ Beep (import starts) ↓ Wait (make some coffee) ↓ Beep-beep (done) ↓The USB icon and the shared folder disappear automatically ↓ Just pull it out
No pre-registration needed. Freshly formatted cards and brand-new cards alike — plug them in and it works. You don’t even need to open the DSM screen.
And if I tell Claude on my iPhone “Do a USB Copy,” I get the same behavior plus a report of the count.
On the Lightroom side, all I do is click “Synchronize Folder,” and 2026-07-21 shows up in the catalog as a new folder.
…I’ve gone and beaten the original.
Going further: sorting by manufacturer or by camera#
If you’ve read this far and you’re sharp, you may have noticed something. This script picks up its targets by looking at file extensions (.nef, .jpg and so on). Which means you could also tell manufacturers apart by extension and change the destination accordingly.
RAW extensions differ neatly by manufacturer.
- Nikon:
.nef - Sony:
.arw - Canon:
.cr3(newer models; slightly older models use.cr2) - Fujifilm:
.raf - Panasonic:
.rw2/ OM Digital:.orf
So you can ask for something like this:
“Send
.neffiles toCreatives/Nikon/and.arwfiles toCreatives/Sony/— split the destination by extension”
If you shoot with multiple mount systems and your gear is a mix of manufacturers, this should be useful. Just plug in the card, and everything gets sorted by manufacturer on its own.
And one step further. Many cameras let the photographer set the file name prefix. On a Nikon you can change DSC_ to any three characters, and if you assign something like BIRD or WORK to each body…
“Files whose names start with
BIRDgo toBirds/, and those starting withWORKgo toWork/”
…you reach automatic sorting by purpose. If you carry two cameras with a setup like “one body just for birds, one for work,” you can build a world where plugging in a card scatters everything into the right purpose folders.
For now I only have one Nikon, so .nef alone is enough, but being able to see from the start how to grow it “when I add more gear” is a reassurance only a homemade tool gives you.
Try telling an AI about your own storage rules#
There’s a reason I went on and on about my folder structure.
The essence of this script is just that I put my storage rules into words and handed them to an AI.
My rule, Creatives/Lightroom/YYYY/YYYY-MM-DD, means nothing to you. But you surely have rules of your own. Some people sort by camera body, some by project, some just roughly by month.
What’s truly convenient about AI chat is that you can convey that in natural language.
“Copy the photos on this memory card into folders in the format
Photos/2026/07/based on the shooting date. Put just the videos separately inVideos. If the same file already exists, skip it.”
That gets the message across. You don’t need to learn shell script syntax, find options or date format specifiers. You just describe the “usual way” in your head, in your own words.
Until now, automation was “a privilege of people who can write scripts.” That has turned into “a right of anyone who can explain their own rules.” I think this shift is truly huge.
Summary#
- The weakness of the stock USB Copy is that tasks are tied to device registration. Once you format the card, the task can’t be triggered
- The solution is to detect cards by “whether there’s a DCIM folder” rather than by device ID. That eliminates the format problem at the root
- For the destination, I turned my own Lightroom workflow rule (
Creatives/Lightroom/YYYY/YYYY-MM-DD) directly into a script - Two kinds of triggers: auto-detection (a task every minute) and chat commands (a request file via the bridge)
- Safety comes from idempotent design + automatic repair of size mismatches + no completion beep and no eject on failure
- The right way to auto-eject is the
synowebapieject API. When you get stuck with DSM’s internal commands, look at the API the UI calls echo 1 > /dev/ttyS1cuts the power. Never get this wrong
What I want to do next#
Several extension ideas have already come to mind.
- Precise sorting by EXIF capture date (exiftool is already installed in the container)
- Automatic reports from Claude after import (number of shots, date range, space used)
- Automatic separation of videos and stills
And the most fun part of all: I can ask the Claude living on the NAS to modify this script itself. The thing I built grows itself inside the environment where it was built. I can’t get enough of that self-propagating feeling.
To everyone who’s been sighing a little every time you format your bird-photography cards: you don’t need to sigh anymore.
And to those of you who haven’t built your own yet: there’s nothing difficult about it. All you need is to put the steps you always follow into words and explain them. Your “usual way” already works perfectly well as a spec.