# Is it possible to force disk /dev/* path?



## ukyo (Aug 19, 2021)

Long story short - I messed up ZFS pool, somehow USB disks are visible under /dev/da0, /dev/da1 etc. They were previously visible as /dev/da0p0, /dev/da1p1.. How can I force FreeBSD to have USB disks as /dev/daXpX pattern? Or maybe it would be better to just force one disk to change, I actually only need to switch /dev/da1 -> /dev/da1p1.


----------



## SirDice (Aug 19, 2021)

You appear to have added the whole disk to the pool instead of the partition on the disk. That's why it's daX instead of daXp1. You can't "force" this back, you will need to remove the wrong disk from the pool and re-add it using the partition. Then let the pool resilver (if you used a mirror or RAID configuration).


----------



## sko (Aug 19, 2021)

The notation shown e.g. via `zpool status` is not necessarily how the system 'searches' for the providers. The pool gets assembled purely by checking the metadata on the disks, so ZFS doesn't care how you call those disks.

You can easily change the visible notation by setting the sysctls 'kern.geom.label.disk_ident.enable', 'kern.geom.label.gptid.enable' and 'kern.geom.label.gpt.enable'.
Setting the first two to '0' and the last one to '1', ZFS shows you the GPT labels (if present):

```
NAME                    STATE     READ WRITE CKSUM
        stor1                   ONLINE       0     0     0
          raidz1-0              ONLINE       0     0     0
            label/cca255027d59  ONLINE       0     0     0
            label/cca255027f11  ONLINE       0     0     0
            label/cca2550291e5  ONLINE       0     0     0
        logs
          mirror-1              ONLINE       0     0     0
            gpt/slog-IN896a9    ONLINE       0     0     0
            gpt/slog-IN89db9    ONLINE       0     0     0
        cache
          gpt/l2arc-IN896a9     ONLINE       0     0     0
          gpt/l2arc-IN89db9     ONLINE       0     0     0
        spares
          da7                   AVAIL
```


----------



## ukyo (Aug 19, 2021)

Ok, so I am using xigmaNAS and it is mirror pool. Virtual Device shows this:




it "sees" ada2 disk, but it doesn't "see" da1p1 - just shows blank spaces

Disk Management shows all disks:



ada2 is correct and da1 is the actual da1p1

Pool itself is in unknown state:




zplool status doesn't show NAS2 pool

```
$ zpool status
  pool: NAS
 state: ONLINE
  scan: resilvered 141G in 0 days 13:07:21 with 0 errors on Thu Aug 19 10:17:08 2021
config:

    NAME        STATE     READ WRITE CKSUM
    NAS         ONLINE       0     0     0
      mirror-0  ONLINE       0     0     0
        ada0    ONLINE       0     0     0
        ada1    ONLINE       0     0     0

errors: No known data errors
```

I don't have any additional backup so I need to be really careful not to mess things more.
I can't access the pool, I have no idea why I can't access ada2 disk with this setup.

so how can I remove faulty disk and add it again? will it really resilver if ada2 is not accessible somehow?


----------



## SirDice (Aug 19, 2021)

ukyo said:


> so I am using xigmaNAS


GhostBSD, pfSense, TrueNAS, and all other FreeBSD Derivatives


----------



## ukyo (Aug 21, 2021)

```
nas: ~# zpool list
NAME   SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
NAS    149G   141G  8.21G        -         -    19%    94%  1.00x  ONLINE  -
nas: ~# zpool import
   pool: NAS2
     id: 1828634793165534911
  state: FAULTED
 status: The pool metadata is corrupted.
 action: The pool cannot be imported due to damaged devices or data.
    The pool may be active on another system, but can be imported using
    the '-f' flag.
   see: http://illumos.org/msg/ZFS-8000-72
 config:

    NAS2        FAULTED  corrupted data
      mirror-0  ONLINE
        ada2    ONLINE
        da1p1   ONLINE
nas: ~# zpool import -f
   pool: NAS2
     id: 1828634793165534911
  state: FAULTED
 status: The pool metadata is corrupted.
 action: The pool cannot be imported due to damaged devices or data.
    The pool may be active on another system, but can be imported using
    the '-f' flag.
   see: http://illumos.org/msg/ZFS-8000-72
 config:

    NAS2        FAULTED  corrupted data
      mirror-0  ONLINE
        ada2    ONLINE
        da1p1   ONLINE

nas: ~# zpool import NAS2
cannot import 'NAS2': pool was previously in use from another system.
Last accessed by <unknown> (hostid=0) at Sun Aug 15 20:21:59 2021
The pool can be imported, use 'zpool import -f' to import the pool.
```


----------

