It’s an error that the folder /data_2 does not exist, what is expected when doing the very first backup. When doing a second one (if configed to keep at least 2 backups) then the error should not appear again!?
This change was introduced here: dietpi-backup: use rsync --link-dest option · MichaIng/DietPi@5bf0d2b · GitHub
Since this does not interfer with the backup functionality directly it’s not a critical problem I guess.
@MichaIng maybe we add a check if the folder already exists?
chatgpt spit out this :
# Find the latest backup for link-dest
LAST_BACKUP=$(ls -1d "$FP_TARGET"/data_* 2>/dev/null | sort | tail -n 1)
# Default rsync options
RSYNC_OPTS=('-aH' '--info=name0' '--info=progress2' '--delete-excluded' "--exclude-from=$FP_FILTER")
# Add link-dest only if a previous backup exists
if [ -n "$LAST_BACKUP" ]; then
RSYNC_OPTS+=("--link-dest=$LAST_BACKUP")
fi
# Use RSYNC_OPTS in Run_Backup
rsync "${RSYNC_OPTS[@]}" -v --log-file="$FP_TARGET/$FP_LOG" "$FP_SOURCE" "$FP_TARGET/data/"
Not an error, just a warning. The option is gracefully ignored if the directory does not exist. But I’ll add it conditionally for next DietPi release to avoid confusion.
EDIT: The ChatGPT solution is not bad either, as it does not depend on data_2 in particular, which someone could have removed intentionally. But since this is an optional speedup and disk usage reduction only, without any practical difference on the resulting backup, I’ll keep it simple for now.