HOWTO: Rename a ZFS pool

The basic process to rename a ZFS pool is to export it from the GUI, import it in the CLI with the new name, then export it again, and re-import it in the GUI.

I find I normally want to do this after creating a new pool (with perhaps a different set of disks/layout), replicating my old pool to the new pool, and then I want to rename the new pool to the same as the old pool, and then all the shares work correctly, and its fairly transparent. Mostly.

(tested with TrueNAS CORE 12U8-1. Works with all versions, including SCALE, see Original Post)

So, firstly, you need to export your pool that you want to rename from the GUI. Note its name.

Before you do that, if your system-dataset is on the pool, its a good idea to move it back to a different pool, or perhaps the boot pool.

System ā†’ System Dataset, then select the pool you want to host it, and save.

Once thatā€™s done,

Storage ā†’ Pools, the click the cog to the right of the pool you want to rename and choose ā€œExport/Disconnectā€

DO NOT TICK ā€œDestroy data on this pool?ā€

It is up to you if you delete the shares, etc, or have to re-configure them when you re-import the pool.

TICK ā€œConfirm Export/Disconnectā€ then click EXPORT/DISCONNECT

ā€¦

Once that is finished fire up a terminal and import the pool into the CLI with the new name.

zpool import original_name new_name

(replace original_name and new_name, respectively)

You can check your handy work with zpool status new_name

Then export the pool again

zpool export new_name

Then import it again in the GUI

Pools ā†’ Add, import existing

Job Done.

You may need to reconfigure your shares etc.

11 Likes

Ported this because AFAIK this functionality is still missing from SCALE, and when I next do it on SCALE, I plan to edit the postā€¦

1 Like

Well done, sir! :clap:t2::clap:t2::clap:t2:

Succinct and easy to implement on TrueNAS Core thanks to your wonderfully written instructions.

Ran through the process on a test vdev before doing it with my primary vdevs.

Remember to copy the old vdev name because once itā€™s disconnect the name is gone!

1 Like

You should be able to get a list of candidate pools to import with zpool import

1 Like

Thanks, I followed this on TrueNAS-SCALE-23.10.2 and worked like a charm. My SMB shares came up fine and even the Bitwarden host on a Debian VM worked fine afterwards. The only slight hick-up was my total storage on my new pool still showed the max capacity of the old pool. But it was simple to fix it turned out the ā€œQuota for this datasetā€ was set to the old value - I just deleted it and voila, perfect. Thanks for creating this.

This worked for me on TrueNAS CORE 13.0-U6.1 with a couple of hiccups.

When I attempted to export the pool from the GUI, the GUI told me an out-of-memory error had occurred and the export did not succeed. I noticed the shares for the pool had been deleted as I asked, presumably before the memory error occurred. This happened repeatedly despite the fact, it would seem, that on the second and subsequent attempts the shares for the relevant pool no longer needed to be deleted. Itā€™s possible this could have been avoided had I deleted the shares myself in a separate step. Once I restarted, the export and the rest of the steps worked smoothly.

Sadly, Time Machine on at least one Mac then decided it didnā€™t like the data that was (from its perspective) in a new location, even though the data itself presumably did not change. So I had to start a fresh backup, but thatā€™s fine because this is not yet a production system. Itā€™s not clear what is to blame for this, but the Mac claimed it might be due to the share having disconnected during verification.

Thanks for this post, I got stuck for a bit until I worked out I had to start a command line with sudo on Truenas Scale Dragonfish-24.04.1.1 to execute commands (sudo zpool import original_name new_name)
My SMB shares were all lost but thatā€™s fine, another opportunity to tidy up and practice my skills.

Iā€™m haviong some issues doing this, (Scale 24.10 currently but had the same issue on 23.10 and 24.04) so iā€™m assuming its just me missign something.

Iā€™m hoping the CLI from System > Shell > ā€œcliā€ and running the zpool commands above ( tried sudo zpool toop) and its saying namespace zpool not found. Am i missing somethign , are there multiple CLIs or something (My machine is headless so cant access the CLI on the machine itself).

Instead of ā€œcliā€ run sudo su -

Then you can use the zpool commands

1 Like

Great thank you. Turned out that 24.10 has a bug that break thats command but rolled back to 23.10 and that fixed it.

Were you having issues with the ā€œzpool importā€ command on 24.10?

Iā€™m having trouble importing the exported pool with this command in CLI - it says it cannot find it. But in the GUI is able to find it just fine.

I cannot roll back since Iā€™m working with a relatively fresh install.

My issue was that the command itself could not be found rather than the pool. Was partly my issue ( ā€˜cliā€™ vs sudo su - ), but also the OS version.

Problem

Click here.

Solution

Worked perfectly, also have to adjust app pointers and snapshots, but easy to do. Thanks for sharing!

1 Like

Mine seems to be having some issue, Iā€™ve run through exporting the pool with the gui, importing it with the new name in cli, exporting again but the gui still has the old nameā€¦

ElectricEel-24.10.0.2