Renaming a ZFS zpool

Renaming a ZFS zpool is as easy as 1-2-3.

  1. export the existing zpool
  2. import the old zpool using the new zpool name
  3. validate any mountpoints

Below I outline each step in the process:

Exporting the zpool

The first step is to export the pool.

zpool export <zpool-name>

For example:

# zpool export pinky

Import the zpool

To import the zpool with a new zpool name we use the following syntax:

zpool import <old-name> <new-name>

In this example we will rename pinky to perky on import:

# zpool import pinky perky
  • NOTE: If for any reason the export of old zpool did not happen cleaning (ie the source system is no longer available and you only had the disks), you will need to import the zpool with the -f to override warnings that the zpool is active. For example:
    # zpool import -f pinky perky
  • NOTE: If you are missing the log device for the zpool you must pass the -m option to the import the zpool without the log:
    # zpool import -f -m pinky perky

Validate zpool mountpoint

Now that we have our new zpool, we probably wont end up with the correct mountpoints. We can confirm this by querying the current mountpoints:

# zfs get mountpoint perky/oradata
NAME           PROPERTY      VALUE                    SOURCE
perky/oradata  mountpoint    /oradata/pinky           default

From the about output, we see that the mountpoint hsa retained it's old property. To assign a new mountpoint we can simply run:

# zfs set mountpoint=/oradata/perky perky/oradata

NOTE: If you changed the mountpoint you will need to check any NFS clients utilising the old mountpoint.