5

In the example below, how can the devices in the second mirror be changed so they they reference the /dev/disk/by-id instead of /dev/sdX?

user@pc:~$ sudo zpool status
  pool: storage
 state: ONLINE
  scan: scrub repaired 0 in 8h30m with 0 errors on Sun May 28 08:54:48 2017
config:

    NAME                                  STATE     READ WRITE CKSUM
    storage                               ONLINE       0     0     0
      mirror-0                            ONLINE       0     0     0
        ata-ST2000AS0002-1NA12Z_Z840MHWP  ONLINE       0     0     0
        ata-ST2000AS0002-1NA12Z_Z840MHTQ  ONLINE       0     0     0
      mirror-1                            ONLINE       0     0     0
        sdd                               ONLINE       0     0     0
        sde                               ONLINE       0     0     0
Greg
  • 1,557
  • 5
  • 24
  • 35

2 Answers2

1

You simpli need to export and re-import your pool with a different default search directory for devices (-d option).

For example:

zpool export storage
zpool import storage -d /dev/disk/by-id
shodanshok
  • 44,038
  • 6
  • 98
  • 162
0

I'm not familiar with ZFS on linux (I'm guessing this is a problem peculiar to linux, Solaris and FreeBSD wouldn't have that kind of device name schizophrenia...) but you might try detaching and reattaching the drives as disk-by-id (be sure to give each time to fully resilver)

zpool detach mirror-1 sdd
zpool attach mirror-1 /dev/disk/sdd-by-id
<wait until zpool status shows it's rebuilt...>

and so on...

quadruplebucky
  • 5,041
  • 18
  • 23