Moving Pool Issues

davep1553

Cadet
Joined
Jan 11, 2020
Messages
6
Hello All,

FYI: I'm running FreeNAS-11.3-U4.1 (want to do some hardware upgrades before I jump to the next version)

So I'm upgrading the main pool on my system to some larger disks. Good news is I can get both the old and the new online at the same time. (barely)

I did this once before but I don't remember exactly what I did and I'm having some issues.

The original pool was named "pool0".

Using the GUI I created a new pool from the new disks and named it "NewPool0"

I then used some shell commands to create a snapshot of pool0 and send it to NewPool0
zfs snapshot -r pool0@01
zfs send -R pool0@01 | zfs receive -Fdvu NewPool0

Yay, all data is copied to the new pool.

I had some issues creating a second snapshot but the first was only a couple hours old and the server was not being used in that time so I figured I'd just rely on the first.

I tried to move the pools around now

zpool export pool0
Error about device busy.
did some umount commands for some shares mounted inside a jail and changed the system dataset to NewPool0 in the GUI and then the command then worked
zpool export pool0
zpool import pool0 old_pool0
Here's where things really went wrong no old_pool0 showed up, nor could I import it in the GUI. pool0 was still there but not functional. I disconnected pool0 in the GUI and couldn't reimport it. (there was no checkbox for destroy data, only the other two.) I rebooted the system and no change. As far as I can tell pool0 is gone

I still have all the data on Pool0New but I still want to rename it to pool0 (so all links/configs/scripts work correctly) but I'm afraid of the command line I did before at this point as I don't have another copy (we'll I do but it's off box and would be a massive pain to restore).

I can create a fresh pool from the old disks and was thinking about using it as an experiment for renaming pools but figured I'd just ask here before I do anything else and mess things up worse.

Thanks in advance for any help
David
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
zpool import pool0 old_pool0
Here's where things really went wrong no old_pool0 showed up, nor could I import it in the GUI.
This is normal, as you have imported it into CLI land. You need to export it again with the new name to then see it in the GUI for importing.
 

davep1553

Cadet
Joined
Jan 11, 2020
Messages
6
To anybody who finds this post I'm going to attempt to completely document what I did. (Also for myself the next time I need to do this.) I'm going to bounce to GUI for anything I can but many of the GUI steps probably have shell options too.

3 pools will be used in this process, the names are here so you can try to find/replace to your names
pool to be replaced: pool0
temporary new pool: poolNew
old pool to be left at the end: poolOld

After connecting all the drives to the system...
In the GUI goto Storage->Pool and click ADD. Follow the prompts to create poolNew with your new disks.
In the shell
zfs snapshot -r pool0@Migrate01
zfs send -R pool0@Migrate01 | zfs receive -Fdvu poolNew
This will take a long time but the server can be used normally while it is running.
Once it's done (and a spot check the data is there on the poolNew)
Shutdown all services and stop all jails, we need the system to be unchanging for the next few steps.
zfs snapshot -r pool0@Migrate02
zfs send -R -i pool0@Migrate01 pool0@Migrate02 | zfs receive -dvu poolNew
This one shouldn't take too long
At this point all data should be synced between pool0 and poolNew, some spot checks are advised (the used size of the two pools might not be identical but should be close.)

the following might be needed, only do them if you have to
in GUI change System->System Dataset to poolNew
in shell do
iocage activate poolNew

in shell do
zpool export pool0
zpool import pool0 poolOld
zpool export poolOld

goto the GUI Storage->Pools, pool0 should be there but empty and non-functional.
click the gear icon next to pool0 and choose export/disconnect from the menu.
Click ADD and import an existing pool. poolOld | <some numbers> should be in the list. Import it.
double check poolOld has all the data (this is intended that all the data is available somewhere at all times so you know you have at least one copy if everything goes wrong)

the following might be needed, only do them if you have to
in GUI change System->System Dataset to poolOld
in shell do
iocage activate poolOld

in shell do
zpool export poolNew
zpool import poolNew pool0
zpool export pool0

goto the GUI Storage->Pools
poolNew should be present but empty and non-functional. Disconnect it by clicking the gear icon next to it and choosing export/disconnect from the menu.
Click ADD, import an existing pool and pool0 | <some numbers> should be in the list, import it.

If you changed either of the following change them back
in GUI change System->System Dataset to pool0
in shell do
iocage activate pool0

you should now be able to restart all services and jails and continue like normal. You may remove poolOld from the system when and if you want to.
 
Top