NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Cannot export/import ZFS pool



On Fri, 12 Feb 2021 at 12:39, Stephen Borrill <netbsd%precedence.co.uk@localhost> wrote:
>
> On Fri, 12 Feb 2021, David Brownlee wrote:
> > On Fri, 12 Feb 2021 at 11:56, Stephen Borrill <netbsd%precedence.co.uk@localhost> wrote:
> >>
> >> NetBSD  9.1_STABLE NetBSD 9.1_STABLE (XEN3_DOMU) #0: Sat Jan  9 19:31:08
> >> UTC 2021 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/xen/compile/XEN3_DOMU amd64
> >>
> >> zfs.kmod has been built with MAXPHYS=32768 as it's a -9 DomU
> >>
> >> # /etc/rc.d/zfs rcvar
> >> # zfs
> >> $zfs=YES
> >> # zpool create tank /dev/xbd1d
> >> # zpool list
> >> NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
> >> tank  99.5G    95K  99.5G         -     0%     0%  1.00x  ONLINE  -
> >> # zpool export tank
> >> # zpool import tank
> >> cannot import 'tank': no such pool available
> >>
> >> This does not seem right.
> >
> > Does using rxbd1 rather than rxbd1d work? I've found real issues
> > trying to use individual partition devices
>
> The only one that works for me is xbd1d:
>
> # zpool create tank /dev/rxbd1
> cannot open '/dev/rxbd1': No such file or directory
> # zpool create tank rxbd1
> cannot open 'rxbd1': no such GEOM provider
> must be a full path or shorthand device name
> # zpool create tank rxbd1d
> cannot create 'tank': invalid argument for this pool operation
> # zpool create tank xbd1
> cannot open 'xbd1': no such GEOM provider
> must be a full path or shorthand device name
> # zpool create tank /dev/xbd1
> cannot open '/dev/xbd1': No such file or directory
> # zpool create tank xbd1d
> # zpool export tank
> # zpool import tank
> cannot import 'tank': no such pool available

<blnk> Could it be some xen magic difference?

That GEOM error is quite specific:

https://nxr.netbsd.org/xref/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c#474
has a check to is_whole_disk which runs  ioctl(fd, DIOCGDINFO, &dl) on
the provided path

Does {r}xbd0 behave differently to {r}xbd0d? - worth a quick test?

cat test.c
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/disklabel.h>
int main(int argc, char** argv) {
    struct disklabel dl;
    int fd;
    for (char **pargv = argv+1; *pargv != argv[argc]; pargv++) {
        char *path = *pargv;
        if ((fd = open(path, O_RDWR | O_NONBLOCK)) < 0) {
            perror(path);
        } else {
            printf("%s: ioctl=%d\n", path, ioctl(fd, DIOCGDINFO, &dl));
            close(fd);
        }
    }
}
cc -Wall -o test test.c && doas ./test /dev/{r,}wd0{d,}
/dev/rwd0d: ioctl=0
/dev/rwd0: ioctl=0
/dev/wd0d: Device busy
/dev/wd0: Device busy

(I an active zpool on wd0, so the Device Busy is reasonable :-p

David


Home | Main Index | Thread Index | Old Index