Howto: migrate data from one pool to a bigger pool

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
There have been a lot of posts recently about how to move data from one pool to another. Usually it's because folks want to upgrade to a much larger pool and the drive-by-drive resilvering process will take too long. I've recently gone through this as well. Here are the steps that I followed.

This assumes that you have both pools setup and connected to the same system, but the replication steps can be done between two systems and the disks moved after replication (this would apply in the instance where the primary machine doesn't have enough ports to handle the additional drives for the second pool).

Assumption is that "tank" is the primary dataset name. "temp-tank" is the name for the new pool prior to data migration.

The steps in a nutshell are replicate from tank to temp-tank, remove (or rename) tank, and then rename temp-tank to tank.

1. the system dataset needs to be moved off of TANK. Use the GUI to select a new location other than tank or temp-tank.

2. Create a system config backup using the GUI. This will be needed later, because when you detach tank, you will lose your share, snapshot and replication settings.

3. Use the GUI to create a snapshot of the dataset you want to move. If you want to move everything, select the root dataset. For flexibility in the future, I'd suggest checking the "recursive" option. Also, minimize use of tank. You will want to pick a time where nothing is changing, then ensure you have a snapshot, and then wait for replication to finish. The amount of time this will take depends on how much storage and the speed of your machine. It took ~36 hours to move 20TB locally for me. [ alternatively, you can use the CLI to create the snapshot and then replicate manually. "zfs snapshot -r tank@migrate" and then "zfs send -R tank@migrate | zfs receive temp-tank"]

4. Once replication is complete and you are satisfied that all data is on temp-tank it's time to detach both tank and temp-tank. Use the GUI to "detach volume" for tank and then repeat for temp-tank. When the confirmation window pops up DO NOT CHOOSE THE OPTION TO DESTROY.

5. using the CLI (or SSH) run the following to import and rename "zpool import tank old-tank" and then "zpool import temp-tank tank". (for reference: zpool import [old-pool-name] [new-pool-name-name])

6. Once the pools are renamed, export them at the CLI "zpool export old-tank" and "zpool export tank"

7. Using the GUI, go to the storage tab and select the import volume tab and import tank. This step is what
enables freenas to understand and control the pool.

8. Once the pool is imported, you can either manually recreate your shares, or you can restore from the configuration backup we made in step 2.

9. I would verify that everything is working to your liking before doing anything with old-tank. For safety, I'd leave it un-imported until you decide you need it or want to get rid of it. If you want to get rid of the data on the disks, I would import old-tank and then once it is in freenas, select the detach volume option for old-tank and this time select the destroy data option to blank out the drives. This is the point of no return, so know what you are doing before confirming.

[edit: note to self - here's the link to a great post on how to move Jails: https://forums.freenas.org/index.ph...-volume-to-new-ssd-volume.42105/#post-271740]
 
Last edited:

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
I still think you're Frans Bauer.
bauer.jpg


I recommend you look up a performance of one of his all-time favorites, the inimitable "Heb Je Even Voor Mij".

Here you go: https://www.youtube.com/watch?v=23_-pAqJf_U
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
:) maybe I am....
 

di0de

Dabbler
Joined
Oct 19, 2013
Messages
48
Thanks for the write up. I used rsync recently to copy about 4TB and it took over 24 hours :confused: Bookmarked for future refernce.
 

Dice

Wizard
Joined
Dec 11, 2015
Messages
1,410
Anyone care to elaborate on why this method is preferred over other methods?
-Such as rsync?
-Or, as something I picked up recently in a thread "doing a cp -v -R source target from a ssh session." ? (don't really remember context, nor have I gotten my own system up and running yet /noobsauce)

Cheers /
 
Last edited:

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
These steps are to move your data to a new pool (of disks) and then be able to use that pool just like you did with the previous pool.

The rsync or cp discussion really only relates to step 3 ( zfs send receive).

As for benefits of zfs send receive, it's the only way to copy the snapshots, and to me I find it simpler to conceptualize. I don't have to worry about source & destination folder locations (I always seem to screw up the rsync trailing slash).
 

Scharbag

Guru
Joined
Feb 1, 2012
Messages
620
Great writeup. As you say, the advantage is that all of your shares/snapshots/replications will be maintained when you are done.

As far as performance, I use Rsync to populate my backup pool (those trailing slashes are such a PITA...) and usually can sync 12TB in a day from scratch. Cannot remember the exact time but it was fast enough. May help that my data is primarily large files. Best part, now that the pools are populated, Rsync takes minutes to complete my daily backups. Best program ever:)

Cheers,
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
Anyone care to elaborate on why this method is preferred over other methods?
rsync is great for replicating files and folders, but it doesn't know anything about datasets. ZFS replication preserves the full ZFS filesystem structure of whatever it replicates.
 

Dice

Wizard
Joined
Dec 11, 2015
Messages
1,410
Excellent clarifications.
One way moving data, from one "temporary files pool" to "the long term storage tank" is best done through rsync and not ZFS replication? (sorry if this turns into offtopic)
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
There's no reason you shouldn't use rsync to move stuff around if it does what you want. The ability to restart a failed transfer is a major plus. Does that answer your question?
 

Scharbag

Guru
Joined
Feb 1, 2012
Messages
620
Excellent clarifications.
One way moving data, from one "temporary files pool" to "the long term storage tank" is best done through rsync and not ZFS replication? (sorry if this turns into offtopic)
It will depend. In the example above, replication is nice because everything (permissions, ownership, names etc.) will be preserved. Rsync, as properly stated above, knows nothing about ZFS. So ignorer to use Rsync, in the above example, you would need to manually create all of the datasets and shares etc. on the new pool and then use Rsync one dataset at a time to copy the data. If you only have one dataset on the pool, then this may be less of an issue:)

Hard to say there is any "best" way. Both have their advantages based on the user's needs.

Cheers,
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874

Mike Bruns

Dabbler
Joined
Dec 9, 2015
Messages
21
Thanks for the guide, worked perfectly so far! For those with stronger unix-fu than me (it's been way too long).

I used the snapshots/replication tasks to replicate all of my data. To confirm that everything is in sync before I destroy my primary pool, is it as simple as running this on my primary:

rsync -az --dry-run /mnt/fullvolume/personal/* 10.1.1.201:/mnt/fullvolume-stage/personal/*

To confirm that I'm not missing any files? Are there any other suggested options to use in the rsync command?
 

madik

Explorer
Joined
May 5, 2014
Messages
54
Can you depasseg please clarify few steps around point 3. and 4. where i get a bit lost?
My plan is to create the "tank temp" pool with larger hdds's on another system with temporary freenas installation. And then replicate all my data to the bigger pool and swap the drives afterwards. So I need to move the data between two systems.
-The Snapshot is created by "Periodic snapshot tasks"?
-The Snapshot of whole dataset will take full dataset size (several TB's) and will be stored in the same pool? How do I fit the snapshot If i running out of space?
- Once I have the snapshot the "replication task" in the GUI can replicate the data to the remote system running Freenas?

Thank you!
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
To confirm that I'm not missing any files? Are there any other suggested options to use in the rsync command?
That's a good idea, but I'm not a wiz at rsync. lmk if it works and I'll add it to the OP.

Thanks!
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
Can you depasseg please clarify few steps around point 3. and 4. where i get a bit lost?
My plan is to create the "tank temp" pool with larger hdds's on another system with temporary freenas installation. And then replicate all my data to the bigger pool and swap the drives afterwards. So I need to move the data between two systems.
-The Snapshot is created by "Periodic snapshot tasks"?
Yes it is.
-The Snapshot of whole dataset will take full dataset size (several TB's) and will be stored in the same pool? How do I fit the snapshot If i running out of space?
You should do some reading on zfs snapshots and replication. Snapshots take up zero space (well not exactly but close enough). It's the data that gets after the snapshot takes place that increases the size.
- Once I have the snapshot the "replication task" in the GUI can replicate the data to the remote system running Freenas?
You can replicate a snapshot to another system, just follow the directions in the manual. You will need to set up the SSH keys for the root user. The rest of the steps would be the same.
 

bmcclure937

Contributor
Joined
Jul 13, 2012
Messages
110
OP - this is a great guide! I am configuring my new FreeNAS and ready to copy data from my old and antiquated FreeNAS 0.7.2 box.

I am running a ZFS pool on the old FN7 box but opted to start fresh on my new FN9 box. I do not wish to use the zpool steps outlined above but think that rsync or CP via SSH would be a good option.

Can others in this thread comment on the best approach to copy directly from my FN7 box to the FN9 (new home media server)?

...
As far as performance, I use Rsync to populate my backup pool (those trailing slashes are such a PITA...) and usually can sync 12TB in a day from scratch. Cannot remember the exact time but it was fast enough. May help that my data is primarily large files. Best part, now that the pools are populated, Rsync takes minutes to complete my daily backups. Best program ever:)

...To confirm that everything is in sync before I destroy my primary pool, is it as simple as running this on my primary:
Code:
rsync -az --dry-run /mnt/fullvolume/personal/* 10.1.1.201:/mnt/fullvolume-stage/personal/*

...
Are there any other suggested options to use in the rsync command?

Anyone care to elaborate on why this method is preferred over other methods?
-Such as rsync?
-Or, as something I picked up recently in a thread "doing a cp -v -R source target from a ssh session." ? (don't really remember context, nor have I gotten my own system up and running yet /noobsauce)

Cheers / Dice

I am also curious about using the rsync or SSH session to CP from one of my FN boxes to the new FN box.
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
great how-to OP! followed it with great success!

only thing i would add is clarification on step 5. I had to look it up because it was never specified, it should be: zpool import [old name] [new name]

thanks again though!;)
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
great how-to OP! followed it with great success!

only thing i would add is clarification on step 5. I had to look it up because it was never specified, it should be: zpool import [old name] [new name]

thanks again though!;)
Glad it helped, but regarding step 5, I think I have it written that way: "zpool import tank old-tank" and then "zpool import temp-tank tank"
 
Top