zfs send receive using netcat

zfs sender part

zfs send tank/test@snap100 | nc -w 20 10.0.1.2 8023

This means that the dataset “test” from my ZFS pool “tank” and snapshot “manual-2020-08-27_19-18” are being sent via netcat to host 10.0.1.2 on port 8023.


zfs receive side

nc -l 8023 -w 120 | zfs receive tank/test

This means that netcat is listening on port 8023 for the dataset “test” and adding it to the ZFS pool “tank”.


to see progress use pv eg.

nc -l 8023 -w 120 | pv | zfs receive tank/test


Send Incremenatl Snapshots

root@141:# zfs list -t snapshot

NAME                  USED  AVAIL  REFER  MOUNTPOINT

LP_Pool/storage@100  2.16M      -  1.38G  -             ## this is already sent 

LP_Pool/storage@101   136K      -  1.89G  -             # new snap 1

LP_Pool/storage@102      0      -  2.91G  -             # new snap 2


root@141:# zfs send -I LP_Pool/storage@100 LP_Pool/storage@102 | nc -w 120 10.45.9.148 44022


It will send @100 @101 and @102.

the recv command will be same

Speed will depend on disk on sendeer side, Eg. below stats show that disk performance is saturated.

iostat -xz 1


avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          49.70    0.00    8.48    0.00    0.00   41.82


Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

sda               0.00     0.00   13.59    0.00    73.79     0.00    10.86     2.71  196.29  196.29    0.00  73.71 100.19

sdb               0.00     0.00   14.56    0.00   166.99     0.00    22.93     2.58  177.33  177.33    0.00  68.80 100.19


avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          48.51    0.00   10.45    2.99    0.00   38.06


Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

sda               0.00     0.00   15.00    0.00   124.00     0.00    16.53     2.52  181.33  181.33    0.00  65.33  98.00

sdb               0.00     0.00   15.00    0.00   120.00     0.00    16.00     2.66  189.87  189.87    0.00  65.33  98.00


avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          38.69    0.00   13.69    0.00    0.00   47.62


Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

sda               0.00     0.00   25.00    0.00   188.00     0.00    15.04     2.57  105.12  105.12    0.00  36.96  92.40

sdb               0.00     0.00   26.00    0.00   192.00     0.00    14.77     2.85  107.38  107.38    0.00  39.38 102.40

No comments:

Post a Comment