--link-dest arg does not exist: ../data_2

  • DietPi version | `G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=17
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’

  • Distro version | trixie

  • Kernel version | Linux DietPi 6.12.43+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.43-1 (2025-08-27) x86_64 GNU/Linuxl

  • Architecture | amd64

  • SBC model | Native PC (x86_64) or (EG: RPi3)

Did an upgrade to v9.17.2.

After the upgrade a did a backup to one of two backup destinations. In the beginning it shows:

--link-dest arg does not exist: ../data_2

[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Services | stop : roonserver
[  OK  ] DietPi-Services | stop : smbd
[  OK  ] DietPi-Services | stop : nmbd
[ INFO ] DietPi-Backup | Checking for required APT packages: rsync
[ INFO ] DietPi-Backup | Checking for sufficient disk space via rsync dry-run, please wait...
--link-dest arg does not exist: ../data_2
[  OK  ] DietPi-Backup | Free space check:

The backup seems to work, but --link-dest arg does not exist: ../data_2 was not there in the previous version.

Torben

Just to confirm: I see the same after upgrading to v9.17.2
--link-dest arg does not exist: ../data_2 --link-dest arg does not exist: ../data_2

Backup seems to have worked, but I do not trust it anymore

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!? :thinking:
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 :sweat_smile::

# 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.

Done:

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.