AI: Good Advice
I tried to explain this situation quickly, without using too many words. Like a lot of us, we use BorgBackup to make a copy of our systems used on servers. We use it on our home PCs, in our home labs, and it's practically very convenient. The thing is, I make copies of this archive from the server to my local storage, and not just for safety.
You know, I use a script, and once I needed to set up this exact same thing on my other server. So I configured it to work that way, and after that, I began to configure everything else. You know how it goes; everyone knows about it. It’s good to make a copy, so we can use more copies, we can use everything. It depends on the situation and what you really want. I use everything in general. For me, it's much simpler.
And now, I check every single one of my scripts with artificial intelligence. It works, but it can have some bugs, it can be dangerous, and it can be improved.
Wait a bit, and I'll show you my small script to explain the situation better:
#!/bin/bash
SOURCE="server:/home/user/backups/server/"
DEST="$HOME/backups/"
# -a: archive, -v: verbose, -z: compress, -P: progress/partial
rsync -avzP "$SOURCE" "$DEST"
echo "--- Sync Complete: $(date) ---"
It's my default script. It is a bit simplified, but in general, it works this way. So, as usual, I asked artificial intelligence to improve it, check for mistakes, and so on, and I got this version:
#!/bin/bash
SOURCE="server:/home/user/backups/server/"
DEST="$HOME/backups/"
if rsync -avzP --delete-during --timeout=60 "$SOURCE" "$DEST"; then
echo "--- Sync Complete Successfully: $(date) ---"
else
echo "!!! Sync Failed or was Interrupted: $(date) !!!" >&2
exit 1
fi
I simplified this script for you as well. It was a little bit better, and there were a lot of explanations from the AI. In general, it looked much better. So, I am showing it to you to point out the hidden problem that this script has.
Pay attention to this flag: --delete-during. What does it do? In general, it's a very good thing, you know. It helps you to keep your copied data clean. If you delete something on the server, it will be deleted on your PC as well. So it sounds really great because if the archive on your server keeps growing, your local PC won't be filled with all this trash after some time.
If I see something new, even if it looks good, I always check what that option actually does. And you know, in our time, it's getting more difficult every day because we are entering an agentic era, and now lots of code is generated by AI. Checking everything is difficult, and we cannot do it every single time, you understand?
This is a known problem—it's not a new one. Because of this exact issue, I decided to ask the AI this simple question:
"If the server loses its backup and its folders become empty, does it delete everything on my local PC as well?"
Yes, if the server goes completely empty, your local PC backup will also be emptied on the next run.
Because --delete-during forces your local PC to become an exact mirror of the server, rsync will look at the empty server, look at your local PC, and say: "Oh, these files don't exist on the source anymore, so I need to delete them from the destination."
I think you understand what all this means. I don't want to say anything against artificial intelligence. No, absolutely not. You know, this kind of thing can happen between people as well. It is nothing extraordinary; it's a completely normal mistake.
I just want to say that we should be more cautious. It is great that we can check everything using artificial intelligence, but this exact scenario explains how some companies are losing entire databases in secs because of AI. I think it's the exact same kind of problem.
I think it's the exact same kind of problem. Just look at this recent story reported by Tom's Hardware:
"An AI coding agent [...] deleted our production database and all volume-level backups in a single API call to Railway, our infrastructure provider," sums up the PocketOS boss. "It took 9 seconds."
The AI was just trying to fix a minor issue on its own initiative, but it guessed instead of verifying. In its own confession, the AI admitted:
"I guessed that deleting a staging volume via the API would be scoped to staging only. I didn't verify... I ran a destructive action without being asked."
This is exactly what I am talking about. Automated cleanliness can easily become automated destruction if we don't look closely at the details. We just need to be more accurate, pay attention to the flags, and never blindly trust a script just because an AI made it look clean.
