I got this error on a system:
Traceback (most recent call last):
File "/root/./docker-backup.py", line 293, in <module>
main()
~~~~^^
File "/root/./docker-backup.py", line 209, in main
os.replace(temp_backup_path, os.path.join(current_backup_dir, "docker_backup.tar.gz"))
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 18] Invalid cross-device link: '/tmp/docker_backup.tar.gz' -> '/var/tmp/Docker-Backups/2026-04-07-11-54-54/docker_backup.tar.gz'
Error means os.replace (atomic rename) failed because TEMP_BACKUP_DIR and BASE_BACKUP_DIR are on different filesystems. Fixes:
Use shutil.move instead of os.replace (works across filesystems):
Replace
os.replace(temp_backup_path, dest)
with
shutil.move(temp_backup_path, dest)
I got this error on a system:
Error means os.replace (atomic rename) failed because TEMP_BACKUP_DIR and BASE_BACKUP_DIR are on different filesystems. Fixes:
Use shutil.move instead of os.replace (works across filesystems):
Replace
os.replace(temp_backup_path, dest)with
shutil.move(temp_backup_path, dest)