# Exporting & Importing pool on the same machine



## JKB (Aug 6, 2016)

I see in the zPool administration section of the handbook that it is possible to export a pool and then import it to "other machines, ZFS supported operating systems, and architectures".

Is it not possible to create a new pool on the same machine and then import an existing pool that is already on that machine?

If so, my plan would be to have 2 pools, 1 that would be for everything in current JBOD media server, and the other for everything else.  Whenever additional storage would be necessary for one, I would like to just get new drives for an entirely new and larger pool at that time and import the pool directly to it vs replacing/resilvering 1 at a time or adding a new vdev to add capacity.  This would allow the data to remain evenly filled and I would think be easier on the hardware as well from what I understand.  That would also give me a pile of hard drives to use as replacements as needed and I would be able to add to them and create a new pool with an optimal organization based on quantity and size of hard drives needed for the next new pool again later on (and then repeat that as needed).

If exporting/importing pools is required to be done to a separate machine, I'll probably go ahead and build a second one now (or at least by the time I outgrow the one I'm currently setting up - likely 18+ months from now) and just rotate back and forth which one serves as the NAS and which one is the backup.

And please point out if you see a major flaw somewhere in my overall plan that I may be overlooking as my whole intent was to find a sensible and less laborious way (both personally and on hardware) way to be able to grow down the road.

Thank you


----------



## tetragir (Aug 7, 2016)

If I understand correctly, you want to use ZFS export and import features to move data between hard drives.
ZFS export is used when you want to move a whole pool to a different machines, aka. you want to move the physical hard drives to another system. Then you do ZFS export, which writes all metadata on the disks you can then remove the hard drives, attach them to the new system and import the pool.
What you are looking for is ZFS send and receive. If your plan is to always buy enough hard drives for a new pool, and move the data from the old pool to the new one, you can use ZFS send and receive. That way you can move datasets between pools (or machines).
ZFS send is covered in the Handbook: https://www.freebsd.org/doc/handbook/zfs-zfs.html


----------



## SirDice (Aug 8, 2016)

JKB said:


> If so, my plan would be to have 2 pools, 1 that would be for everything in current JBOD media server, and the other for everything else. Whenever additional storage would be necessary for one, I would like to just get new drives for an entirely new and larger pool at that time and import the pool directly to it vs replacing/resilvering 1 at a time or adding a new vdev to add capacity.


It looks like you are misunderstanding the import/export function of ZFS. This is not what import/export is used for. What you want to do is probably better done using ZFS' send/receive. 

The import/export is because the Zpool is more or less marked as "in use" by a particular machine. In order to move an entire pool to another machine you use the export/import function. The export simply removes the "in use by...." so another machine can use it. If you don't export the pool you will get an error message on the other machine, something like "this pool is in use by....".


----------



## JKB (Aug 9, 2016)

Thank you both - the ZFS send/receive seems to be what I would need to do.  

The only note I had made in that section of the manual was how to do a backup in the future.  I clearly hadn't had my revelation on what I was trying or hoping to be able to accomplish at that point b/c I had nothing marked or noted about the "store the data on another pool connected to the local system".

Overall, does my intended approach seem reasonable/practical?  

Unless there is some big drawback seen to doing it that way, I probably just need to go ahead and do a full test run with a handful the hard drives (I guess enough to set up at least 2 vdevs so I can work through that too), and use just a small amount of data to see how much trouble I get myself into with all of this before everything gets moved to it.  Thought I had a pretty good idea of what I was going to do a couple of months ago, and once I put the new machine together and booted through the "guided partitioning" section in early July, I just kept having one question after another and each one seemed to bring on about 5 new questions which was taking me farther and farther from thinking I had any type of long term, suitable plan in mind...


----------

