Rsync vs. mv: Lessons from a Broken File Transfer
Don’t Be Like Me — Use rsync
Recently, my home Jellyfin server ran out of storage.
To fix that, I added a new, larger drive to store the Jellyfin media data.
After mounting the new drive, I used the mv command to transfer the old data into the new storage.
Unfortunately, my Windows laptop, which I was using to SSH into the server decided to restart for an update mid-transfer, interrupting the process halfway.
🕳 The Problem
Because the transfer was done using mv, the operation did not survive the disconnection.
I also wasn’t using screen or tmux, so I couldn’t reconnect to the session and resume.
I had to manually inspect the files to see what had been moved and what hadn’t.
To make things worse, I thought mv wouldn’t work properly if the destination folder already contained files, so I assumed I had to delete everything and start over.
That’s when I learned (thanks to ChatGPT) that:
💡 You can use rsync to transfer files even on the same machine, not just over a network.
I used to think rsync was only for remote transfers like scp. I was wrong.
Why rsync is a better choice
When a mv is interrupted:
- It doesn’t keep track of what was already moved.
- It can’t resume where it left off.
- It may leave the destination in a half-copied state.
Meanwhile, rsync:
- Can resume partial transfers.
- Skips files that are already copied.
- Works whether you’re transferring locally or remotely.
- Can optionally delete the source files only after each successful copy
-remove-source-files
What I did to recover
1. Checked the target folder:
ls -lah /mnt/1tb-drive/hlp-media/jellyfin/data/
Output (simplified):
Movies/ → 37G
Music/ → 1.6G
TV/ → 105G
2. Compared with the source:
ls -lah /srv/sftp/jellyuser/data/
du -sh /srv/sftp/jellyuser/data/*
Output:
Movies/ → 74G
Learning/ → 63G (not transferred yet)
Music/ → 1.6G
TV/ → 105G
My first instinct (which wasn’t great)
Originally, I thought I had to delete the entire target folder and start over:
rm -rf /mnt/1tb-drive/hlp-media/jellyfin/data/*
mv -v /srv/sftp/jellyuser/data /mnt/1tb-drive/hlp-media/jellyfin
But that would be slow, risky, and wasteful especially if the large TV and Music folders were already correctly copied.
🛠 The Better Way: tmux + rsync
Here’s the safer and smarter method:
Step 1: Start a persistent shell using tmux
tmux new -s transferjob
If your SSH session disconnects, you can resume it later with:
tmux attach -t transferjob
Step 2: Run rsync to resume the transfer without deleting anything
sudo rsync -av /srv/sftp/jellyuser/data/ /mnt/1tb-drive/hlp-media/jellyfin/data/
This:
- Copies only missing or updated files
- Keeps already-copied files
- Doesn’t require wiping the destination
- Lets you resume if interrupted again
Lessons Learned
rsyncis not just for remote transfers — it’s great for local transfers too- Always use
tmuxorscreenfor long-running SSH tasks mvis dumb;rsyncis smart- You don’t need to delete target directories just because they’re not empty
I am just an idiot that learned something the hard way.
Thanks to ChatGPT, I am glad that I stumble upon this mistake at home where the stakes were low and the risk was minimal.
Now I’ve learned a valuable habit for the future, and maybe saved myself from a much bigger mess down the road.