Let’s say we have two different samba share folders and we want to make a 100% copy of one of them (source) to another (traget).
The best tool for that would be rsync. It can sync folders and make the target 100% exact copy of the source, keeping the file times, permissions, and delete non-existing files.
The best place where it can be done is the machine (i.e. samba server) of one of those share folders with rsync installed.
So for example, we are on the machine of target, and rsync is preinstalled, we would need to mount the source folder on the target machine:
sudo mount -t cifs //<SourceSamba>/<SambaFolder>/ /mnt/<SambaFolder> -o username=<SambaUser>,password=<SambaPassword>,iocharset=utf8,userThen we can just run the following command and all is done:
rsync -avz --delete-after --info=progress2 --info=name0 <Source> <Target>In our example, the exact command will look like:
rsync -avz --delete-after --info=progress2 --info=name0 /mnt/TrueNAS/folder1/ /volume1/Backup/folder1Don’t forget to test it properly before you are running the file-changing commands, you can do a dry-run:
rsync -avzn --delete-after --info=progress2 --info=name0 /mnt/TrueNAS/folder1/ /volume1/Backup/folder1Let me know how you are doing the backups or syncing your folders.

Leave a Reply
You must be logged in to post a comment.