ZFS replication

Status
Not open for further replies.

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
This is an extension from a previous thread I started but it began as something a bit different and I'd like this to be a reference for anyone else needing help with ZFS replication in the future.

My overall goal is to upgrade my storage from a single 1x4tb to a 4x4tb RAID Z2. All disks are WD Red's

My current 1x4tb drive (diskA) has 1.6TB of data. I want to temporarily copy disk A's data to a 2TB (diskB). After the copy is completed, I'll then take disk A and combine it with 3 new 4TB drives to form a 4x4tb RAID Z2 pool. Afterwards I'd like transfer the data from disk B back to my newly created RAID Z2 pool.

ZFS replication seems like the best option. But im having a bit of trouble with the commands.

From what I understand, is I need to create a snapshot of the dataset diskA I want to copy and use the zfs send command to the disk B. I created the snapshots through the GUI. The snapshot I'd like to send to disk B is "mymedia/movies@movies-0306"



Code:
[root@freenas] /# zfs list -t snapshot
NAME                                                                    USED  AVAIL  REFER  MOUNTPOINT
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201501212031@2015-02-20-09:53:36  4.42M      -   938M  -
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502271818@2015-01-14-03:50:40   934M      -   934M  -
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502271818@2015-01-22-20:31:05   324M      -   936M  -
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502271818@2015-02-20-04:01:24   328M      -   939M  -
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502271818@2015-02-23-04:14:13   272M      -   938M  -
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502271818@2015-03-01-03:45:11   273M      -   950M  -
freenas-boot/grub@Pre-Upgrade-FreeNAS-9.3-STABLE-201501090144            42K      -  7.77M  -
freenas-boot/grub@Pre-Upgrade-FreeNAS-9.3-STABLE-201501212031          45.5K      -  7.77M  -
freenas-boot/grub@Pre-Upgrade-FreeNAS-9.3-STABLE-201502162250            50K      -  7.78M  -
freenas-boot/grub@Pre-Upgrade-FreeNAS-9.3-STABLE-201502210408          7.78M      -  7.79M  -
freenas-boot/grub@Pre-Upgrade-FreeNAS-9.3-STABLE-201502271818          7.78M      -  7.80M  -
mymedia@main-20150306                                                      0      -   244K  -
mymedia/.warden-template-pluginjail@clean                                88K      -   719M  -
mymedia/Jails/.warden-template-pluginjail@clean                        7.88M      -   719M  -
mymedia/Jails/.warden-template-standard@clean                            88K      -  1.55G  -
mymedia/movies@movies-0306                                                 0      -  1.31T  -
[root@freenas] /#



It's last item in list. Here's the zfs list of disk A (mymedia) and disk B (temp2tb) which has been already formatted zfs and has an empty dataset already created. disk B and its dataset are the last 2 items.

Code:
[root@freenas] /# zfs list
NAME                                                      USED  AVAIL  REFER  MOUNTPOINT
freenas-boot                                             3.79G  10.6G    31K  none
freenas-boot/ROOT                                        3.75G  10.6G    31K  none
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201501090144        3.56M  10.6G   935M  /
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201501212031        9.80M  10.6G   939M  /
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502162250        4.43M  10.6G   938M  /
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502210408        4.82M  10.6G   950M  /
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201502271818        3.73G  10.6G   930M  /
freenas-boot/ROOT/default                                2.92M  10.6G   934M  legacy
freenas-boot/grub                                        31.2M  10.6G  7.80M  legacy
mymedia                                                  1.65T  1.86T   244K  /mnt/mymedia
mymedia/.system                                          5.70M  1.86T  2.61M  legacy
mymedia/.system/cores                                    1.10M  1.86T  1.10M  legacy
mymedia/.system/rrd-5d7cf704701c492ab661d665947c290a       96K  1.86T    96K  legacy
mymedia/.system/samba4                                    648K  1.86T   648K  legacy
mymedia/.system/syslog-5d7cf704701c492ab661d665947c290a  1.27M  1.86T  1.27M  legacy
mymedia/.warden-template-pluginjail                       719M  1.86T   719M  /mnt/mymedia/.warden-template-pluginjail
mymedia/Jails                                            30.2G  1.86T   232K  /mnt/mymedia/Jails
mymedia/Jails/.warden-template-pluginjail                 727M  1.86T   719M  /mnt/mymedia/Jails/.warden-template-pluginjail
mymedia/Jails/.warden-template-standard                  1.55G  1.86T  1.55G  /mnt/mymedia/Jails/.warden-template-standard
mymedia/Jails/couchpotato_1                               265M  1.86T   978M  /mnt/mymedia/Jails/couchpotato_1
mymedia/Jails/crashplan_1                                 331M  1.86T  1.02G  /mnt/mymedia/Jails/crashplan_1
mymedia/Jails/headphones_1                                182M  1.86T   896M  /mnt/mymedia/Jails/headphones_1
mymedia/Jails/openvpn                                     335M  1.86T  1.65G  /mnt/mymedia/Jails/openvpn
mymedia/Jails/owncloud                                    468M  1.86T  1.78G  /mnt/mymedia/Jails/owncloud
mymedia/Jails/plex                                       22.7G  1.86T  23.4G  /mnt/mymedia/Jails/plex
mymedia/Jails/sabnzbd_1                                   167M  1.86T   881M  /mnt/mymedia/Jails/sabnzbd_1
mymedia/Jails/sonarr_1                                    749M  1.86T  1.43G  /mnt/mymedia/Jails/sonarr_1
mymedia/Jails/subsonic_1                                 1.51G  1.86T  2.21G  /mnt/mymedia/Jails/subsonic_1
mymedia/Jails/transmission_1                             1.36G  1.86T  1.69G  /mnt/mymedia/Jails/transmission_1
mymedia/downloads                                        16.8G  1.86T  16.8G  /mnt/mymedia/downloads
mymedia/movies                                           1.31T  1.86T  1.31T  /mnt/mymedia/movies
mymedia/music                                              96K  1.86T    96K  /mnt/mymedia/music
mymedia/openvpn                                           172K  1.86T   172K  /mnt/mymedia/openvpn
mymedia/tv                                                298G  1.86T   298G  /mnt/mymedia/tv
temp2tb                                                   396K  1.76T    96K  /mnt/temp2tb
temp2tb/dataset                                            96K  1.76T    96K  /mnt/temp2tb/dataset
[root@freenas] /#


So now when i try to zfs send disk A snapshot 'mymedia/movies@movies-0306' to disk B, I keep getting below

Code:
[root@freenas] /# zfs send mymedia/movies@movies-0306 | zfs receive temp2tb/dataset

cannot receive new filesystem stream: destination 'temp2tb/dataset' exists
must specify -F to overwrite it
warning: cannot send 'mymedia/movies@movies-0306': Broken pipe
[root@freenas] /# zfs send mymedia/movies@movies-0306 | zfs receive temp2tb
cannot receive new filesystem stream: destination 'temp2tb' exists
must specify -F to overwrite it
warning: cannot send 'mymedia/movies@movies-0306': Broken pipe
[root@freenas] /# zfs send mymedia/movies@movies-0306 | zfs receive temp2tb/dataset
cannot receive new filesystem stream: destination 'temp2tb/dataset' exists
must specify -F to overwrite it
warning: cannot send 'mymedia/movies@movies-0306': Broken pipe


So am I supposed to overwrite the dataset on disk B? Thats fine as there's nothing on it, but I also get that broken pipe error as well.

What am I doing wrong?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Status
Not open for further replies.
Top