Renaming Volume with data already in it

edusantos

Cadet
Joined
May 24, 2013
Messages
6
Hi everyone,

Quick question!

I have 2 volumes, each one has 2x3TB HDD's in a ZFS mirror setting.

My question is, is there a simple way to rename both volumes names without destroying the data? If so, how? :o

Best regards,
Eduardo
 

edusantos

Cadet
Joined
May 24, 2013
Messages
6
I've done it. :) I will keep this small guide here so others can find this.

What I basically did is export the zpool using the shell command line (not on the web interface) (9).

The commands a fairly simple.

zpool export [current zpool name here]

zpool import [current zpool name here][space here][new zpool name here]

Example:

zpool export volume0

zpool import volume0 volume1

Keep in mind that afterwards, at least I had to do it, to detach the volumes (zpools) from the system (DON'T CHECK THE OPTION TO ERASE DATA).

Reboot.

Auto-import volumes (zpools).

And bahm! New names, data kept intact! :D

More Information [Detailed]:

http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch04s06.html
http://doc.freenas.org/index.php/Volumes [Detach Volume Section]
http://prefetch.net/blog/index.php/2006/11/15/renaming-a-zfs-pool/

#EDIT:
1. Fixed some typos. [07-04-2013]
 

KevinM

Contributor
Joined
Apr 23, 2013
Messages
106
Thanks edusantos! I just now did this and couldn't believe how easy it was, maybe 5 minutes total. I followed your instructions, fixed the paths to the shares, that was it really. I was expecting it to be more of an ordeal...
 

edusantos

Cadet
Joined
May 24, 2013
Messages
6
Thanks Kevin! Glad I could help! :) Sometimes stuff that sound harder end up being quite simple in the end, this is a perfect example.
 

Mark Stock

Cadet
Joined
Jul 30, 2016
Messages
6
I've done it. :) I will keep this small guide here so others can find this.
What I basically did is export the zpool using the shell command line (not on the web interface) (9).
Keep in mind that afterwards, at least I had to do it, to detach the volumes (zpools) from the system (DON'T CHECK THE OPTION TO ERASE DATA).
Reboot.
Auto-import volumes (zpools).

I did this up to here, but I can't find "Auto-import volumes" in the GUI. When I look at Storage->Volumes->Import Volume, in Step 2/2, under the Volume pulldown, nothing shows up. There's no reference in the Docs to "Auto Import" either.

When I ssh in, I can see the new pool. But I can't see it from the GUI.
Code:
$ sudo zpool list
NAME            SIZE  ALLOC  FREE  EXPANDSZ  FRAG  CAP  DEDUP  HEALTH  ALTROOT
freenas-boot   59.5G  617M  58.9G  -  -  1%  1.00x  ONLINE  -
pool0          4.98T  3.54T  1.45T  -  38%  70%  1.00x  ONLINE  -


(EDIT) Problem solved. DO NOT IMPORT FROM THE COMMAND LINE INTERFACE. To rename my pool, I first ssh'd in and used the CLI to export the pool, then the CLI to import it with the new name, then the CLI to export it again, then I rebooted, THEN I was able to see it in the GUI under Storage->Volumes->Import Volume. I wish there was a better way to rename a pool. Or, at least, to have the GUI and documentation state clearly that what I know as a "pool" is instead referred to as a "volume."
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
There's no reference in the Docs to "Auto Import" either.
That's because you're reading (and replying to) a three-year-old thread, and the UI has changed.
 

Mark Stock

Cadet
Joined
Jul 30, 2016
Messages
6
Then why don't we have a section in the documentation for this? It seems to be asked frequently, and with subtly different answers each time, AND requires going to the CLI (I think---I haven't exhaustively searched and read every thread relating to this). My first search led me to a blog post, and it led me astray (I left a comment warning of the error and pointing to this Forum).
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I would expect the reason it isn't in the docs is because it doesn't actually come up that frequently--it seems like every year or two there's a thread about it, but that's hardly frequent. But if you think it should be there, you can file a bug against the docs suggesting that. You're correct that it can't be done through the GUI. The correct process is this:
  • Export pool from GUI
  • From CLI, 'zpool import oldname newname'
  • From CLI, 'zpool export newname'
  • Import pool from GUI
  • Fix all your shares and anything else dependent on the path to the old pool.
 

Mark Stock

Cadet
Joined
Jul 30, 2016
Messages
6
Thank you. I think that that is frequent enough, and the existing information different enough, that a definitive answer should exist at a higher level. I will submit the report as you suggest and point to this thread.

I can get grumpy about things at times, but I have to say that, despite the usual growing pains, I find FreeNAS to be a far superior system for solid data storage and administration than running my own software RAID or btrfs systems.
 

Thomas_s-h

Contributor
Joined
Feb 7, 2013
Messages
140
I've done it. :) I will keep this small guide here so others can find this.

What I basically did is export the zpool using the shell command line (not on the web interface) (9).

The commands a fairly simple.



Example:



Keep in mind that afterwards, at least I had to do it, to detach the volumes (zpools) from the system (DON'T CHECK THE OPTION TO ERASE DATA).

Reboot.

Auto-import volumes (zpools).

And bahm! New names, data kept intact! :D

More Information [Detailed]:

http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch04s06.html
http://doc.freenas.org/index.php/Volumes [Detach Volume Section]
http://prefetch.net/blog/index.php/2006/11/15/renaming-a-zfs-pool/

#EDIT:
1. Fixed some typos. [07-04-2013]

Hallo,

in 2016 "no bahm!"...

Wenn der zpool online ist kommt die Fehlermeldung "zpool busy". Wenn ich den zpool per Webgui abmelden, und dann auf der Konsole (Shell) den export eintippe, dann kommt die Fehlermeldung das der zpool nicht bekannt wäre.

Schade, deine Idee höre sich so gut an.

Thomas

Hello,

In 2016 "no bahm!" ...

If the zpool online is the error message "zpool busy". When I log out of the zpool via Webgui, and then on the console (shell) the export in, then comes the error message that the zpool is not known.

Too bad, your idea sounds so good.

Thomas
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419

svtkobra7

Patron
Joined
Jan 12, 2017
Messages
202
I would expect the reason it isn't in the docs is because it doesn't actually come up that frequently--it seems like every year or two there's a thread about it, but that's hardly frequent. But if you think it should be there, you can file a bug against the docs suggesting that. You're correct that it can't be done through the GUI. The correct process is this:
  • Export pool from GUI
  • From CLI, 'zpool import oldname newname'
  • From CLI, 'zpool export newname'
  • Import pool from GUI
  • Fix all your shares and anything else dependent on the path to the old pool.

I'm attempting to change an existing pool's name from "temp-tank" to "Tank2".
  • I export from the GUI without issue,
Detach1.jpg
  • but from CLI when I attempt to import, I receive an error.
zpool import temp-tank Tank2
cannot import 'temp-tank': no such pool available

  • Not wanting to fool around with an encrypted pool, I end up re-importing the pool.
Detach2.jpg

Detach3.jpg

Config: FN11, "Pool1" named "Tank1" and "Pool2" named "temp-tank"
Of Note: Since this is an ecrypted pool, passphrase set, geli key downloaded, geli recovery key downloaded, geli meta data backed up (also, config saved)
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Yeah, with encryption, you would need to unlock the disks first. I've never worked with encryption in FreeNAS (though I've seen plenty of people lose their data that way), so am not sure how you'd do that.
 

svtkobra7

Patron
Joined
Jan 12, 2017
Messages
202
Yeah, with encryption, you would need to unlock the disks first. I've never worked with encryption in FreeNAS (though I've seen plenty of people lose their data that way), so am not sure how you'd do that.

Thanks for the prompt reply, your post gave me the idea to try just that (unlock disks first). Steps I took:

1. Copy geli.key to /data/geli (although it could be any directory)
2. GELI ATTACH for each disk in the encrypted volume
geli attach -k geli.key daXp1 where X is disk name
Enter passphrase: (Enter the passphrase, repeat geli attach for next disk)
Repeat for all disks in encrypted volume name you want to change
3. Note zpool status won't show encrypted volume
Code:
NAS# zpool status
  pool: freenas-boot
state: ONLINE
  scan: scrub repaired 0 in 0h0m with 0 errors on Mon Jun 19 11:03:07 2017
config:

  NAME  STATE  READ WRITE CKSUM
  freenas-boot  ONLINE  0  0  0
  da0p2  ONLINE  0  0  0

4. NAS# zpool import [OLDNAME] [NEWNAME]
5. NAS# zpool export [NEWNAME]
6. GUI => Import Volume

Success.jpg

[Hopefully of some help to others pondering the question I had]

Not sure what impact a volume name name change has on GELI, but probably not a bad idea to rekey (and back up meta).
 

dch

Cadet
Joined
Feb 18, 2018
Messages
2
As this is the 1st link for FreeNAS rename pool, just noting that the terminal based zpool export / import / export wasn't sufficient for me. I tried to re-import it in the GUI and the GUI drop-down menu unfortunately hated on me.

You *do* need to detach the pool from the new UI, and then re-import it. After that, all's well and I could apply the other zpool related settings and shares.
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
  • Export pool from GUI
  • From CLI, 'zpool import oldname newname'
  • From CLI, 'zpool export newname'
  • Import pool from GUI
  • Fix all your shares and anything else dependent on the path to the old pool.

Is this procedure still working? When I'm trying to import (2nd command) says that the pool is not available. Of course, the import from the GUI, works perfectly.
 
Top