How to set up an incremental backup of a working directory containing projects to an external network storage NAS using the BorgBackup utility with deduplication?

Answer

Efficient backup of large volumes of source code and multimedia assets requires specialized software capable of saving disk space. Standard folder copying creates numerous file duplicates, which quickly fills up available space on a server or network-attached storage (NAS).

The BorgBackup utility is one of the best tools for developers because it supports reliable client-side data encryption, compression, and efficient block-level deduplication. This means that if a project file has changed by just a single line, only this modified block will be written to the storage, rather than an entire copy of the file.

Install BorgBackup on your local computer and initialize a new repository on your NAS server, setting a secure encryption password that must be saved in a password manager.
Create a simple automation script that will run the archive creation command, specifying the paths to project folders and excluding cache directories like node_modules or vendor.
Configure the retention policy for old backups using the built-in prune command, which automatically removes outdated archives according to a daily, weekly, and monthly copy retention scheme.

Using BorgBackup allows you to store the history of project changes spanning several years within a minimal amount of disk space on a network drive. In addition, archives can be mounted as a standard file system in read-only mode for quick recovery of accidentally deleted files or older source code versions.

To be fully confident in data safety, it is recommended to set up replication of the created Borg repository to a second remote server or cloud storage using the built-in feature for fast repository synchronization without decrypting the data itself.

Was this answer helpful?

More questions in this topic

Related questions from other topics