I’ve been a happy ZFS user for years, appreciating its robustness and features. Yet, in all that time, I’d never had to rename a pool. That changed today. Whether it’s for better organization, a server migration, or just because you’ve had a change of heart about a name, renaming a ZFS pool is a task that might pop up when you least expect it.
I needed to rename my pool from anime35 to anime36. I was pleasantly surprised to find the process is incredibly simple and elegant, which is what I’ve come to expect from ZFS.
Here’s a quick guide for my future self, and for anyone else who needs to do the same.
The Two-Step Rename Process
Renaming a ZFS pool is a simple two-step process: you export the pool, and then import it with a new name.
Export the pool: This detaches the pool from the system. It’s a crucial step that ensures the pool is not in use while you’re making changes.
[root@watamem ~]# zpool export anime35Import with a new name: Now, you import the pool back, specifying the old name and the new name you want to use.
[root@watamem ~]# zpool import anime35 anime36
Verify the Change
And that’s it! You can verify the change with zpool status:
[root@watamem ~]# zpool status
pool: anime36
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
anime36 ONLINE 0 0 0
usb-Samsung_SSD_840_EVO_250G_533144424E5341444137303939315A20-0:0 ONLINE 0 0 0
errors: No known data errors
As you can see, the pool is now named anime36 and is back online.
It’s a simple and safe procedure, but as with any storage operation, make sure you don’t have any data being actively written to the pool when you export it.
So, if you ever find yourself needing to rename a ZFS pool, don’t fret. It’s a quick and painless operation.