ZFS zpool import -d /dev/diskid tank

I want to change from zpool status tank showing /dev/daX to /dev/diskid but it wont remember this after reboot.
if I try to import my pool I get some strange errors:
Code:
 zpool import -d /dev/diskid/ tank
cannot import 'tank': no such pool available
zpool import tank 
is ok
zpool export tank
zpool import -d /dev/diskid/ tank
zpool status tank
 tank                            ONLINE       0     0     0
          raidz2-0                      ONLINE       0     0     0
            diskid/DISK-71U0A0GWFZ0G    ONLINE       0     0     0
            diskid/DISK-PK1334PEHKRV0S  ONLINE       0     0     0
            diskid/DISK-PK2338P4HPPT9C  ONLINE       0     0     0
            diskid/DISK-PK1334PEHKHHUS  ONLINE       0     0     0
            diskid/DISK-PK1334PEHLKSGS  ONLINE       0     0     0
            diskid/DISK-PK2338P4HTMKHC  ONLINE       0     0     0
            diskid/DISK-PK1334PEHKZHUS  ONLINE       0     0     0
            diskid/DISK-71U0A0GDFZ0G    ONLINE       0     0     0
after reboot:
Code:
 tank        ONLINE       0     0     0
          raidz2-0  ONLINE       0     0     0
            da6     ONLINE       0     0     0
            da5     ONLINE       0     0     0
            da4     ONLINE       0     0     0
            da3     ONLINE       0     0     0
            da2     ONLINE       0     0     0
            da1     ONLINE       0     0     0
            da0     ONLINE       0     0     0
            da7     ONLINE       0     0     0
Anyone have a solution to this?
 
Last edited by a moderator:
It's not really a solution, but ZFS uses the internal VDEV identifiers when identifying the VDEVs in a pool, so it is really only cosmetics (for display purposes). It does not make any functional difference and there is no additional risk if you use one or the other.
If displaying the DISK IDs instead of device names matters to you, I would also like to know the solution. I don't know how to do it myself.
 
Maybe try zpool import -d /dev/gpt tank. If you are using GPT and gave labels to the disks, maybe you could import them by names with that.
 
Another idea. Maybe Disk identifiers are disabled in the kernel. Check this with:
Bash:
sysctl
kern.geom.label.disk_ident.enable: 0
If not enabled, you can enable it in /boot/loader.conf:
Bash:
kern.geom.label.disk_ident.enable=1

After a reboot, the /dev/diskid should be available with your devices and you can try reimporting from that.
 
Are you booting from tank?
I went through this with a mirrored setup on one of my systems.
As long as the devices are not in a "stripe" but some kind of redundancy, the process is basically:
zpool detach <existingname>
pool goes to degraded state
zpool attach tank <preferred name like /dev/diskid/blah>
wait for the pool to finish resilvering
go detach a different device

The last part, about reattaching with a new name:
Make sure you use the correct command for your configuration. There is a big difference between attach and add.

Edit:
It's important to be methodical about this. One device at a time, wait for the pool to finish resilvering before doing the next. I only had a mirror, but the process should be similar.
 
[...] As long as the devices are not in a "stripe" but some kind of redundancy, the process is basically:
zpool detach <existingname>
pool goes to degraded state
zpool attach tank <preferred name like /dev/diskid/blah>
I think it should be "As long as the devices are in a mirror, [...]"

For a raidz configuration of the OP I cannot imagine detaching-attaching to work.
zpool-detach(8):
Detaches device from a mirror.
zpool-attach(8):
The existing device cannot be part of a raidz configuration.

Based on The /etc/zfs/zpool.cache file and its directly following section, you might try (haven't tried this myself):
  1. export the pool
  2. import the pool using zpool imort -d /dev/diskid/ <pool_name>
  3. get your cachefile location with zdb -C
  4. regenerate the cachefile by zpool set cachefile=/<your_cachefile_location>/zpool.cache <pool_name>
  5. reboot and see what's happened

Edit: according to Changing a pool name to persist after reboot applying zpool-reguid(8) also seems to do that in additions to some more "resets"
 
Erichans having only configured mirrors, you are probably correct.
I think for raidz stuff it may be a combination of zpool offline, zpool online maybe zpool replace
 
Sorry for my late respond here but the
kern.geom.label.disk_ident.enable="1"
in
/boot/loader.conf
was the solution
Thanks :)
 
Back
Top