Migrating Sending Side
Objective: Move sending-side zpool to new hardware. Make the move fully transparent to the sending-side jobs. After the move is done, all sending-side zrepl jobs should continue to work as if the move had not happened. In particular, incremental replication should be able to pick up where it left before the move.
Suppose we want to migrate all data from one zpool oldpool
to another zpool newpool
.
A possible reason might be that we want to change RAID levels, ashift
, or just migrate over to next-gen hardware.
If the pool names are different, zrepl’s matching between sender and receiver dataset will break becase the receive-side dataset names contain oldpool
.
To avoid this, we will need the name of the new pool to match that of the old pool.
The following steps will accomplish this:
Stop zrepl.
Create the new pool:
zpool create newpool ...
Take a snapshot of the old pool so that you have something that you can
zfs send
. For example, runzfs snapshot -r oldpool@migration_oldpool_newpool
.Send all of the oldpool’s datasets to the new pool:
zfs send -R oldpool@migration_oldpool_newpool | zfs recv -F newpool
Export the old pool:
zpool export oldpool
Export the new pool:
zpool export newpool
(Optional) Change the name of the old pool to something that does not conflict with the new pool. We are going to use the name
oldoldpool
in this example. Usezpool import
with no arguments to see the pool id. Thenzpool import <id> oldoldpool && zpool export oldoldpool
.Import the new pool, while changing the name to match the old pool:
zpool import newpool oldpool
Start zrepl again and wake up the relevant jobs.
Use
zrepl status
or you monitoring to ensure that replication works. The best test is an end-to-end test where you write some junk data on a sender dataset and wait until a snapshot with that data appears on the receiving side.Once you are confident that replication is working, you may dispose of the old pool.
Note that, depending on pruning rules, it will not be possible to switch back to the old pool seamlessly, i.e., without a full re-replication.