Most of you will know that Ubuntu 16.04 will have ZFS merged into the kernel. Despite licensing arguments I see this as a positive move. I recently tested btrfs replication (http://blog.ls-al.com/btrfs-replication/) but being a long time Solaris admin and understanding how easy ZFS makes things I welcome this development. Here is a quick test of ZFS replication between two Ubuntu 16.04 hosts.
Install zfs utils on both hosts.
# apt-get install zfsutils-linuxQuick and dirty create zpools using an image just for the test.
root@u1604b1-m1:~# dd if=/dev/zero of=/tank1.img bs=1G count=1 &> /dev/nullroot@u1604b1-m1:~# zpool create tank1 /tank1.imgroot@u1604b1-m1:~# zpool listNAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOTtank1 1008M 50K 1008M - 0% 0% 1.00x ONLINE -
root@u1604b1-m2:~# dd if=/dev/zero of=/tank1.img bs=1G count=1 &> /dev/nullroot@u1604b1-m2:~# zpool create tank1 /tank1.imgroot@u1604b1-m2:~# zpool listNAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOTtank1 1008M 64K 1008M - 0% 0% 1.00x ONLINE -root@u1604b1-m2:~# zfs listNAME USED AVAIL REFER MOUNTPOINTtank1 55K 976M 19K /tank1Copy a file into the source file system.
root@u1604b1-m1:~# cp /media/sf_E_DRIVE/W.pdf /tank1/root@u1604b1-m1:~# ls -lh /tank1total 12M-rwxr-x--- 1 root root 12M Apr 20 19:22 W.pdfTake a snapshot.
root@u1604b1-m1:~# zfs snapshot tank1@snapshot1root@u1604b1-m1:~# zfs list -t snapshotNAME USED AVAIL REFER MOUNTPOINTtank1@snapshot1 0 - 11.2M -Verify empty target
root@u1604b1-m2:~# zfs listNAME USED AVAIL REFER MOUNTPOINTtank1 55K 976M 19K /tank1
root@u1604b1-m2:~# zfs list -t snapshotno datasets availableSend initial
root@u1604b1-m1:~# zfs send tank1@snapshot1 | ssh root@192.168.2.29 zfs recv tank1root@192.168.2.29's password:cannot receive new filesystem stream: destination 'tank1' existsmust specify -F to overwrite itwarning: cannot send 'tank1@snapshot1': Broken pipe
root@u1604b1-m1:~# zfs send tank1@snapshot1 | ssh root@192.168.2.29 zfs recv -F tank1root@192.168.2.29's password:Check target.
root@u1604b1-m2:~# zfs list -t snapshotNAME USED AVAIL REFER MOUNTPOINTtank1@snapshot1 0 - 11.2M -root@u1604b1-m2:~# ls -lh /tank1total 12M-rwxr-x--- 1 root root 12M Apr 20 19:22 W.pdfLets populate one more file and take a new snapshot.
root@u1604b1-m1:~# cp /media/sf_E_DRIVE/S.pdf /tank1root@u1604b1-m1:~# zfs snapshot tank1@snapshot2Incremental send
root@u1604b1-m1:~# zfs send -i tank1@snapshot1 tank1@snapshot2 | ssh root@192.168.2.29 zfs recv tank1root@192.168.2.29's password:Check target
root@u1604b1-m2:~# ls -lh /tank1total 12M-rwxr-x--- 1 root root 375K Apr 20 19:27 S.pdf-rwxr-x--- 1 root root 12M Apr 20 19:22 W.pdf
root@u1604b1-m2:~# zfs list -t snapshotNAME USED AVAIL REFER MOUNTPOINTtank1@snapshot1 9K - 11.2M -tank1@snapshot2 0 - 11.5M -