[OpenIndiana-discuss] Antwort: Transferring everything in one zpool to be a subtree in another larger zpool

Thorsten Heit thorsten.heit at vkb.de
Mon May 4 08:25:35 UTC 2015


Hi,

> I have this old machine running oi151a7 with a zpool containing a set of
> filesystems used for media files of various types, and I want to 
transfer
> them all, in one go, safely but not unnecessarily slowly, to a new zpool 
on
> a different machine.
> 
> The old zpool is on a 2tb two-disk mirror on the oi151a7,  while the new
> zpool is a freenas raidz2 of 12tb or so actual data space.
> 
> I want your advice on what is the correct, safest and/or most practical 
way
> to do it.
> 
> Both machines are on a GB network, and neither of them will be doing
> anything else while transferring the data.
> 
> I'm guessing zfs send/recv over the network, using nc for buffering, but
> I've never done this before, so please advice me.


Quite easy with zfs and a little time for the sending/receiving process:

1) Create a snapshot of the pool you intend to move:

root at oldmachine:# zfs snapshot -r <oldpool>@<snapshot_name>


2) Send the pool to your new machine:

root at oldmachine:# zfs send -R <oldpool>@<snapshot_name> | \
    ssh root@<new_machine> '/usr/sbin/zfs receive <newpool>/<new_name>'

"-R" creates a replication stream package that sends everything 
recursively up to the named snapshot, including properties, snapshots, 
descendent file systems and clones.

If you're not interested in older snapshots, use "-rp" instead of "-R" 
whereas "-r" creates a recursive stream package and "-p" tells "zfs send" 
to include properties.


3) Have a coffee or two and wait :-)


4) Optionally move the received zfs filesystems, volumes, ... one level up 
in your new pool:

root at newmachine:# zfs rename <newpool>/<new_name>/<filesystem1> 
<newpool>/<filesystem1>


I have done this several times in the past without problems. You could 
optionally compress the stream with gzip and uncompress it when receiving:

root at oldmachine:# zfs send -R <oldpool>@<snapshot_name> | gzip | \
    ssh root@<new_machine> '/usr/bin/gunzip | /usr/sbin/zfs receive 
<newpool>/<new_name>'


In my experience with some 100GB of data this took far longer in our LAN 
than the same without compressing although the sending and receiving 
machines should have been fast enough...


If you don't want to send the whole pool, replace "<oldpool>" above with 
the file system / data set you're interested in; the commands stay the 
same.


Best regards

Thorsten


More information about the openindiana-discuss mailing list