ZFS change gpt label for pool provider

I have a raid1 zfs pool where I've been forced to move the disks to a different cabinet. I name the disks by cabinet, shelf, partition, etc., so I would like to relabel some of the disks. That is, can I take a disk in the pool with a gpt label and relabel it and not have to resilver the pool?

Can one simply 'offline' the disk, use gpart to relabel the disk, and then do an 'online' with the new label? Will zfs find the disk and use the new label appropriately?

Or does one have to 'offline' it, then use gpart to relabel the disk, and then do a 'replace' with the new label, causing it to resilver?
  • Thanks
Reactions: Oko
Responding to my own post, I went ahead and tried some things. In order to simplify the discussion, suppose the pool name is "storage", the original gpt label is "disk", and the new label is "newdisk".

First, I took the disk offline with the following:

zpool offline storage gpt/disk

This succeeded without comment and on doing a zpool status the following line showed it offline:
    7433479765038126178      OFFLINE      0     0     0  was /dev/gpt/disk
Then I changed the gpt name to the newname and did the following:

zpool online storage gpt/newdisk

This failed with the following comment:
    cannot online gpt/newdisk: no such device in pool
Then I tried to replace the disk with

zpool replace storage 7433479765038126178 gpt/newdisk

This resulted in:
    invalid vdev specification
    use '-f' to override the following errors:
    /dev/gpt/newdisk is part of active pool 'storage'
So I tried

zpool replace -f storage 7433479765038126178 gpt/newdisk

which resulted in
    invalid vdev specification
    the following errors must be manually repaired:
    /dev/gpt/newdisk is part of active pool 'storage'
The I changed the label back to the origin name with gpart and did an online, which restored the pool after a short resilvering.

Does anyone know why the replace failed?
If I understand you correctly, I believe you want to zpool export the pool, change the partition labels, and then zpool import the pool (using the -d switch if necessary). This should trigger the desired update of the pool's vdev metadata.