Folders selected for synchronization have a hidden .sync/Archive directory inside. This directory stores old versions of updated or deleted files: if an agent updates a file, other agents move their local copies to the Archive. The archive can be a good source for restoring unintentionally deleted or modified files.
The archive's behavior is configured in the Agent's Profile:
- Use Archive: disables/enables Archive at all. On versions prior to 2.12 change of this setting is not applied to currently existing sync job, it's applied to newly created jobs.
- Max archive file size (MB): the max size of a file that will be moved to Archive. Increase it if you work with big files. Bear in mind that this will require more storage space.
- Max archive file age (days): number of days a file remains in Archive until automatically removed. The longer it's kept, the longer it takes storage space. Decreasing this value makes sense if storage space is limited. You can manually clear the Archive every now and then so as not to wait for automatic deletion.
Archive on mobile devices works similarly with the following caveat:
- Files are kept there for 1 day only and this cannot be changed.
Archive role in processing file renames
From the system's point of view, renaming is equivalent to deleting old_filename and creating new_filename. The hash of the file remains the same. When an agent renames a file, other agents process it through the Archive: old_filename is moved to the Archive, and instead of re-downloading the new_filename, they take it out from the Archive. It saves time and network bandwidth.
Archive in Synchronization job
In a Sync job, all agents create .sync directory. An Agent understands that a file is updated if it receives a system notification about it or if it detects a change during the period folder scan.
Upon change, the Agent will recheck the file and, if it has read-write permission in the job, it will upload the new version to other agents. Others will move their current file to their Archive folder and download the updated file.
An important note: the agent where the file was locally updated does not store the older file's version!
When a file is deleted
If an Agent deletes a file, other Agents will move the file from the syncing folder to their Archive. An Agent will consider a file to be deleted if the file is no longer located in its original place.
An important note: the deleted file will not be moved to the Archive on the agent that originated the deletion!
Restoring files from Archive
To open the Archive:
- enable hidden items in the file browser and navigate to .sync directory manually; Or
- right-click on the job in the Agent UI and select Open Archive (works only for Sync Jobs)
When files are added to the Archive, their "modified" timestamp reflects the time they were placed there.
If the Archive already has a file with the same name, the new version one gets (i) index, increments of 1.
This meta-data can help identify the file version that needs to be restored.
Resilio Connect does not support automatic restoring of files, this can only be done manually using a file manager - just move or copy the file out of the Archive back to its original. Remove the (i) index or rename the file as needed.
Important: an agent must be running when you take a file out of the Archive. The file has a "modified" timestamp older than that on other agents. If the Agent is running during the restore operation, it detects the file change and uploads it to others. If it is not running, the restore operation will fail - the file will be overwritten by the file with the more recent "modified" timestamp.
Archive in Distribution and Consolidation jobs
With these Jobs, only the destination agents create .sync directory. Since transfer jobs are not continuously syncing (but rather a one-time file transfer), the Archive on destination agents works differently:
- Files updated on the source agent end up in the Archive of the destination agents only upon the next job run.
- If the Agent profile has the option "Delete files absent on source agent (Transfer jobs)" set to Yes, the deleted files are NOT placed in the Archive of the destination agents.
- If a file is renamed on the source, it's re-synced to the destination agents on the next job run. File rename is not processed through the Archive.