From 5ba8a054501139410fccbd7258ed9097590bc50e Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 23 Feb 2026 17:47:05 +0100 Subject: [PATCH] cifs: use rsync instead cp -aRl for some reason, cp fails on synology cifs for some paths - immich's typesense dir --- src/storage/filesystem.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 74ef60451..85b0ae6d0 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -183,6 +183,14 @@ async function copyInternal(config, fromPath, toPath, options, progressCallback) progressCallback({ message: `Copying ${fullFromPath} to ${fullToPath}` }); + // on synology cifs, cp -aRl does not work for unknown reasons + if (config._provider === mounts.MOUNT_TYPE_CIFS && !config.noHardlinks && options.recursive) { + const rsyncArgs = ['-a', `--link-dest=${fullFromPath}/`, `${fullFromPath}/`, fullToPath]; + const [rsyncError] = await safe(shell.spawn('rsync', rsyncArgs, {})); + if (rsyncError) throw new BoxError(BoxError.EXTERNAL_ERROR, rsyncError.message); + return; + } + let cpOptions = ((config._provider !== mounts.MOUNT_TYPE_MOUNTPOINT && config._provider !== mounts.MOUNT_TYPE_CIFS) || config.preserveAttributes) ? '-a' : '-d'; if (options.recursive) cpOptions += 'R'; cpOptions += config.noHardlinks ? '' : 'l'; // this will hardlink backups saving space