totalAldo / zxfer

An optimized version of zxfer focused on performance
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

zxfer (turbo)

2024 - This is a refactored version of zxfer, with the goal of optimizing ZFS replication. Enhancements include improved code readability and performance, additional error handling functions, and new options.

These changes were motivated by the lengthy replication times experienced when transferring large dataset snapshots. These modifications have significantly decreased the time required for both ssh and local replication.

Example usage with new options

Replicate two remote pools from the same host over ssh. Use -j8 to run 8 parallel zfs list commands on the source host. Begin replication of the first pool in the background so that both host pools are replicated in parallel.

From the same host, use zstd -9 -T0 compression on the source, and -Y to repeat replication until there are no changes in the destination.

New Options

Performance Improvements

Code Refactoring

The code has been refactored for better readability and maintainability, which includes:

Feedback Welcome

If you use this script and have any suggestions or feedback, please open an issue or a pull request. I hope this script will be beneficial to others and that useful features can be incorporated into the main project.

Testing

This fork has been tested with FreeBSD 14.0, FreeBSD 14.1

Acknowledgements

A big thank you to everyone who contributed to this script over the past 16+ years, and to all its users.

Best Wishes, Aldo


Original README Contents:

A continuation of development on zxfer, a popular script for managing ZFS snapshot replication

The Original author seems to have abandoned the project, there have been no updates since May 2011 and the script fails to work correctly in FreeBSD versions after 8.2 and 9.0 due to new ZFS properties.

Original Project Home

Changes

Installation

You will need to be root before starting.

$ su

FreeBSD:

Via pkg (Recommended)

pkg install zxfer

Via Ports

Auto

a) Go to ports directory.

# cd /usr/ports/sysutils/zxfer

b) Install

# make install
Manual

Here are the directions for those who want to do it manually. a) Copy zxfer to /usr/local/sbin.

# cp zxfer /usr/local/sbin

b) Copy zxfer.8.gz to /usr/local/man/man8

# cp zxfer.8.gz /usr/local/man/man8

FreeNAS

As the freenas file system is not persistent for user changes, we will need to;

a) Create a standard jail via the freenas UI

b) Add the datasets required for the transfer to the jail via the jails storage manager in the UI

c) Use either the pkg or port methods above to install zxfer

all instructions for the above can be found here

http://doc.freenas.org/9.3/freenas_jails.html

OpenSolaris, Solaris 11 Express:

a) Copy zxfer to /usr/sfw/bin.

# cp zxfer /usr/sfw/bin

b) Set the path to include this.

# PATH=$PATH:/usr/sfw/bin

c) Copy zxfer.1m to /usr/share/man/man1m

# cp zxfer.1m /usr/share/man/man1m

d) Delete the old catman page, if you are updating.

# rm /usr/share/man/cat1m/zxfer.1m

e) Set the MANPATH variable correctly.

# MANPATH=$MANPATH:/usr/sfw/share/man

Note that this will not set the paths permanently.

(I don't know how. If you know how, please inform me.)