This is historic content that may contain outdated information. For the newest information on FreeNAS and TrueNAS, please visit TrueNAS.com or read our latest Blogs.
Why would an organization want to replicate data?
Replication for disaster recovery is becoming more and more common for organizations of every size. This is due to the business impact that occurs when data cannot be recovered quickly from a catastrophic disaster, long term power outages, ransomware, network loss, or permanent data loss due to hardware failure.
A TrueNAS storage array provides high-performance, comprehensive file and block data protection using snapshots and TrueSync bidirectional data replication. You can establish an automatic protection schedule to meet your SLAs, or run snapshots and replication manually. The web-based graphical user interface is used to control every aspect of snapshots and replication.
There are a few basic requirements in order to replicate using TrueNAS. You will need a system containing the source data and a replication target system with available capacity, and both of these systems need to be able to talk to each other on the network. Since a dedicated replication network is not always possible, TrueNAS has the ability to throttle replication jobs to a specified MB/s to avoid network saturation.
TrueNAS Replication Methods
TrueNAS uses the OpenZFS file system, which supports read-only file system snapshots. Snapshots are not stored as physical copies of blocks, but as pointers to the blocks that existed when the snapshot was created. Initially, snapshots consume no extra space in the ZFS pool and can be created instantaneously. Snapshots are used to save the state of a file system at a particular point in time and allow the file system to be rolled back to exactly that same state. OpenZFS snapshots are intelligent because they only store incremental block-level deltas. This means that when large files change slightly, such as virtual machine disks, only the changed blocks are saved and replicated.
The built-in replication commands used by OpenZFS are zfs send and zfs receive. These commands copy (zfs send) a snapshot to a destination system (zfs receive) asynchronously using the SSH protocol while compressing the data over the wire. Asynchronous replication is more economical than add-on replication technologies, such as continuous data protection, due to sending only delta changes. This makes it an ideal solution to support disaster recovery and business continuity. Additionally, the replication process has no impact on latency or IOPS of write I/O, unlike synchronous replication. Furthermore, the nature of asynchronous replication doesn’t require a minimum network link speed.
Multiple replication jobs can be configured for the same OpenZFS pool or file system. This allows you to set different retention policies. For example, you could replicate every 15 minutes, and keep those snapshots for X amount of hours, days, or weeks. You can also setup a second replication job to run once a day with a retention time of X amount of weeks or months. Replication is the ideal and most efficient form of duplicating data between OpenZFS systems.
TrueNAS also supports rsync. It is recommended to only use rsync when either the source or destination file systems are not OpenZFS. While OpenZFS replication only replicates changed blocks, rsync traverses the full file system and replicates an entire file if any blocks have changed since the last rsync job. Additionally, rsync can populate the read cache (ARC/SSD) with the data being traversed, which can effectively stomp on working data that should be cached. Additionally, rsync can be a formidable replication protocol, depending on the organization’s replication requirements.
There are a variety of ways to setup replication flow. One method is to replicate two or more production TrueNAS appliances to one TrueNAS appliance at a disaster recovery site.
Alternatively, multiple TrueNAS appliances could replicate one to the other, essentially forming a replication ring.
I’ll cover other replication methods in future blog posts.
Single File Recovery
When using OpenZFS replication you might ask yourself: how do I recover an independent file and not rollback my entire file system? The answer is to clone a specific snapshot based on date and time, and mount it. A clone is a writable version of a snapshot, with block-level pointers to the file system from which it was created. As with snapshots, creating a clone is nearly instantaneous and initially consumes no additional disk space. This allows you to browse and copy needed files. Additionally, if you are using Microsoft SMB, TrueNAS supports Volume Shadow Copy Service (VSS). You can right click on an SMB mounted folder and browse/navigate snapshots to find particular files and recover them with TrueNAS.
Stay tuned for more in this replication blog series.
John Sanderson, Sales Engineer