Renaming a ZFS pool

While messing around with ZFS last weekend, I noticed that I made a typo when I created one of my pools. Instead of naming a pool “apps,” I accidentally named it “app”:

$ zpool status -v

  pool: app
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        app         ONLINE       0     0     0
          c0d1      ONLINE       0     0     0
          c1d0      ONLINE       0     0     0
          c1d1      ONLINE       0     0     0

errors: No known data errors

To fix this annoyance, I first exported the pool:

$ zpool export app

And then imported it with the correct name:

$ zpool import app apps

After the import completed, my pool contained the name I had originally intended to give it:

$ zpool status -v

  pool: apps
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        apps        ONLINE       0     0     0
          c0d1      ONLINE       0     0     0
          c1d0      ONLINE       0     0     0
          c1d1      ONLINE       0     0     0

errors: No known data errors

Niiiiiiiiiiiiiiiiice!

18 thoughts on “Renaming a ZFS pool”

  1. How would renaming a zpool affect an existing filesystem/ZFS that is also being shared via NFS?

    For example, I thought to make my zpool1 to /foo (under which my ZFS mount point exists), to prevent filling up the / disk in case something wrote to /foo and not /foo/mountpoint.

  2. What would you do if you have two identical named pools?
    For example I had installed OpenSolaris on the first drive and SXCE (in zfs) on the second drive. However I forgot that both OS standard are using the same pool names.
    The difference seems that both pool names have a different ID number.

    By the way nice skyline image from San Diego.

    Emmanuel,
    Halle,
    Belgium

  3. I am a chinese.
    I also have trouble in it.
    Good work!I solve it as the step.
    Thank you very much!

  4. Yes, even now nearly 2 years after you posted this it’s still teaching people who are new to zfs (me!) 8-)

    Thanks!

    D

  5. Emmanuel, you can use the UUID which is listed when running “zfs import” during the import to use another name … while that creates trouble when using another system with the same pool as it’s persistent (like having a USB disk or doing recovery work from another box or …)

  6. Does not seem to work anymore in 2015 on Ubuntu 14.04 with ZFS on Linux 0.6.4.1-1~trusty.

    # zpool import app apps
    cannot import ‘app’: no such pool available

  7. 11 years after posting this hint it still is a very helpful one. I’ve tried to find out renaming pools with manpage, but without success. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *