You are not logged in.

#1 2014-08-14 03:17:51

mattbarszcz
Member
Registered: 2012-06-25
Posts: 35

[Solved] Can't Import ZFS Pool as /dev/disk/by-id

I have a 4 disk raidz1 pool "data" made up of 3TB disks.  Each disk is so that that partition 1 is a 2GB swap partition, and partition 2 is the rest of the drive.  The zpool was built out of /dev/disk/by-id(s) pointing to the second partition.

# lsblk -i
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  2.7T  0 disk
|-sda1   8:1    0    2G  0 part
`-sda2   8:2    0  2.7T  0 part
sdb      8:16   0  2.7T  0 disk
|-sdb1   8:17   0    2G  0 part
`-sdb2   8:18   0  2.7T  0 part
sdc      8:32   0  2.7T  0 disk
|-sdc1   8:33   0    2G  0 part
`-sdc2   8:34   0  2.7T  0 part
sdd      8:48   0  2.7T  0 disk
|-sdd1   8:49   0    2G  0 part
`-sdd2   8:50   0  2.7T  0 part
sde      8:64   1 14.9G  0 disk
|-sde1   8:65   1  100M  0 part /boot
`-sde2   8:66   1    3G  0 part /

I had a strange disk failure where the controller one one of the drives flaked out and caused my zpool not to come online after a reboot, and I had to zpool export data/zpool import data to get the zpool put back together.  However, now it is fixed, but my drives are now identified by their device name:

[root@osiris disk]# zpool status
  pool: data
 state: ONLINE
  scan: resilvered 36K in 0h0m with 0 errors on Wed Aug 13 22:37:19 2014
config:

        NAME        STATE     READ WRITE CKSUM
        data        ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            sda2    ONLINE       0     0     0
            sdb2    ONLINE       0     0     0
            sdc2    ONLINE       0     0     0
            sdd2    ONLINE       0     0     0

errors: No known data errors

If I try to import by-id without a zpool name, I get this (its trying to import the disks, not the partitions):

cannot import 'data': one or more devices is currently unavailable
[root@osiris disk]# zpool import -d /dev/disk/by-id/
   pool: data
     id: 16401462993758165592
  state: FAULTED
 status: One or more devices contains corrupted data.
 action: The pool cannot be imported due to damaged devices or data.
   see: http://zfsonlinux.org/msg/ZFS-8000-5E
 config:

        data                                 FAULTED  corrupted data
          raidz1-0                           ONLINE
            ata-ST3000DM001-1CH166_Z1F28ZJX  UNAVAIL  corrupted data
            ata-ST3000DM001-1CH166_Z1F0XAXV  UNAVAIL  corrupted data
            ata-ST3000DM001-1CH166_Z1F108YC  UNAVAIL  corrupted data
            ata-ST3000DM001-1CH166_Z1F12FJZ  UNAVAIL  corrupted data

[root@osiris disk]# zpool status
no pools available

... and the import doesn't succeed.

If I put the pool name at the end, I get:

[root@osiris disk]# zpool import -d /dev/disk/by-id/ data
cannot import 'data': one or more devices is currently unavailable

Yet, if I do the same thing with the /dev/disk/by-partuuid paths, it seems to work fine (other than the fact that I don't want partuuids).  Presumably because there are no entries here for entire disks.

[root@osiris disk]# zpool import -d /dev/disk/by-partuuid/ data
[root@osiris disk]# zpool status
  pool: data
 state: ONLINE
  scan: resilvered 36K in 0h0m with 0 errors on Wed Aug 13 22:37:19 2014
config:

        NAME                                      STATE     READ WRITE CKSUM
        data                                      ONLINE       0     0     0
          raidz1-0                                ONLINE       0     0     0
            d8bd1ef5-fab9-4d47-8d30-a031de9cd368  ONLINE       0     0     0
            fbe63a02-0976-42ed-8ecb-10f1506625f6  ONLINE       0     0     0
            3d1c9279-0708-475d-aa0c-545c98408117  ONLINE       0     0     0
            a2d9067c-85b9-45ea-8a23-350123211140  ONLINE       0     0     0

errors: No known data errors

As another approach, I tried to offline and replace sda2 with /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F28ZJX-part2, but that doesn't work either:

[root@osiris disk]# zpool offline data sda2
[root@osiris disk]# zpool status
  pool: data
 state: DEGRADED
status: One or more devices has been taken offline by the administrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
  scan: resilvered 36K in 0h0m with 0 errors on Wed Aug 13 22:37:19 2014
config:

        NAME        STATE     READ WRITE CKSUM
        data        DEGRADED     0     0     0
          raidz1-0  DEGRADED     0     0     0
            sda2    OFFLINE      0     0     0
            sdb2    ONLINE       0     0     0
            sdc2    ONLINE       0     0     0
            sdd2    ONLINE       0     0     0

errors: No known data errors
[root@osiris disk]# zpool replace data sda2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F28ZJX-part2
invalid vdev specification
use '-f' to override the following errors:
/dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F28ZJX-part2 is part of active pool 'data'
[root@osiris disk]# zpool replace -f data sda2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F28ZJX-part2
invalid vdev specification
the following errors must be manually repaired:
/dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F28ZJX-part2 is part of active pool 'data'

I would appreciate if anyone else had any suggestions/workarounds on how to fix this

As I was typing this up, I stumbled upon a solution by deleting the symlinks that pointed to entire devices in /dev/disk/by-id (ata-* and wwn*).  I then was able to do a zpool import -d /dev/disk/by-id data and it pulled in the partition 2's.  It persisted after a reboot and my symlinks were automatically regenerated when the system came back up:

[root@osiris server]# zpool status
  pool: data
 state: ONLINE
  scan: resilvered 36K in 0h0m with 0 errors on Wed Aug 13 23:06:46 2014
config:

        NAME                                       STATE     READ WRITE CKSUM
        data                                       ONLINE       0     0     0
          raidz1-0                                 ONLINE       0     0     0
            ata-ST3000DM001-1CH166_Z1F28ZJX-part2  ONLINE       0     0     0
            ata-ST3000DM001-1CH166_Z1F0XAXV-part2  ONLINE       0     0     0
            ata-ST3000DM001-1CH166_Z1F108YC-part2  ONLINE       0     0     0
            ata-ST3000DM001-1CH166_Z1F12FJZ-part2  ONLINE       0     0     0

It would appear to be an issue with specifically importing non-whole devices by-id.  Although this was mainly rambling and no longer a question, hopefully this might help someone having issues re-importing a zpool by /dev/disk/by-id.

Matt

Offline

#2 2014-12-18 09:47:54

eH4t
Member
Registered: 2014-12-18
Posts: 1

Re: [Solved] Can't Import ZFS Pool as /dev/disk/by-id

This just saved my morning smile Thank you!
I was using Ubuntu 14.04 and after an upgrade to 3.13.0-43-generic it somehow broke... Anyhow now the zpool survives restarts again and I don't have to import it every time using partuuids.

Offline

#3 2014-12-19 00:09:31

mattbarszcz
Member
Registered: 2012-06-25
Posts: 35

Re: [Solved] Can't Import ZFS Pool as /dev/disk/by-id

I'm glad the info helped you out.

Offline

Board footer

Powered by FluxBB