btrfs data replication ********************** Introduction ============ The btrfs replication scheme is based on btrfs send/receive. OpenSVC uses btrfs snapshots to ensure incremental send/receive replication. Source and targets maintain a btrfs snapshot @sent to identify the last incremental synchronization done properly. This state is used to check that the deltas application sequence is not broken. If broken, alerts are emited and a full sync must be scheduled Command set =========== :cmd:`syncnodes` Initial synchronization or incremental synchronisation. First one will be a Initial synchronisation, next will be incremental Status ====== :state:`up` Last synchronization occured less than sync_max_delay minutes ago. :state:`warn` Last synchronization occured more than sync_max_delay minutes ago. Internals ========= A replication action applies the following logic: - create @tosent readonly snapshots on sender - for each subvol-remote pair - send/receive the @tosent snap - rotate @tosent to @sent on remote - recursive clean-up of the destination final location on remote - install the @sent subvol as rw snapshots on remotes - rotate @tosent to @sent on sender Implementation details ====================== There are some shortcomings in the current btrfs send/receive implementation that opensvc works around : - no recursive snapshot/delete/send : for now you have to declare one sync resource per subvol, even if they are organised as a tree. - btrfs receive is easily confused when looking for a subvol parent id : for now opensvc has to mount the ID5 root vol on ``/btrfs/