ZFS zpool 创建失败,因为设备是活动 md 的一部分

ZFS zpool 创建失败,因为设备是活动 md 的一部分

我正在尝试在我收到的新机器上安装 ZFS。我是 ZFS 的新手,但我在另一台服务器上运行它,它位于一整块磁盘上。在我收到的当前机器上有一个更复杂的设置,其中两个磁盘组成一个 raid,并带有 mdadm。

我收到此错误

# zpool create zdata md2p2
cannot open '/dev/md2p2': Device or resource busy
cannot create 'zdata': one or more vdevs refer to the same device, or one of
the devices is part of an active md or lvm device

lsblk:

# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    0   1.8T  0 disk
├─sda1        8:1    0    32G  0 part
│ └─md0       9:0    0    32G  0 raid1 [SWAP]
├─sda2        8:2    0   512M  0 part
│ └─md1       9:1    0 511.4M  0 raid1 /boot
└─sda3        8:3    0   1.8T  0 part
  └─md2       9:2    0   1.8T  0 raid1 /
    ├─md2p1 259:0    0  19.1G  0 md
    └─md2p2 259:1    0   1.8T  0 md
sdb           8:16   0   1.8T  0 disk
├─sdb1        8:17   0    32G  0 part
│ └─md0       9:0    0    32G  0 raid1 [SWAP]
├─sdb2        8:18   0   512M  0 part
│ └─md1       9:1    0 511.4M  0 raid1 /boot
└─sdb3        8:19   0   1.8T  0 part
  └─md2       9:2    0   1.8T  0 raid1 /
    ├─md2p1 259:0    0  19.1G  0 md
    └─md2p2 259:1    0   1.8T  0 md

山:

# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=32937948k,nr_inodes=8234487,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=6593532k,mode=755)
/dev/md2 on / type ext4 (rw,relatime,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=22577)
mqueue on /dev/mqueue type mqueue (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
/dev/md1 on /boot type ext3 (rw,relatime,stripe=4,data=ordered)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=6593528k,mode=700)

fdisk:

# fdisk -l
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x28a866e7

Device     Boot    Start        End    Sectors  Size Id Type
/dev/sda1           2048   67110911   67108864   32G fd Linux raid autodetect
/dev/sda2       67110912   68159487    1048576  512M fd Linux raid autodetect
/dev/sda3       68159488 3907027119 3838867632  1.8T fd Linux raid autodetect


Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xcd73e68c

Device     Boot    Start        End    Sectors  Size Id Type
/dev/sdb1           2048   67110911   67108864   32G fd Linux raid autodetect
/dev/sdb2       67110912   68159487    1048576  512M fd Linux raid autodetect
/dev/sdb3       68159488 3907027119 3838867632  1.8T fd Linux raid autodetect


Disk /dev/md1: 511.4 MiB, 536281088 bytes, 1047424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md2: 1.8 TiB, 1965365985280 bytes, 3838605440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x946b7bbf

Device     Boot    Start        End    Sectors  Size Id Type
/dev/md2p1          2048   40000000   39997953 19.1G 83 Linux
/dev/md2p2      40001536 3838605439 3798603904  1.8T 83 Linux


Disk /dev/md0: 32 GiB, 34326183936 bytes, 67043328 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

管理

# mdadm --detail /dev/md2
/dev/md2:
           Version : 1.2
     Creation Time : Sun Dec 30 15:41:04 2018
        Raid Level : raid1
        Array Size : 1919302720 (1830.39 GiB 1965.37 GB)
     Used Dev Size : 1919302720 (1830.39 GiB 1965.37 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Sun Dec 30 16:57:49 2018
             State : clean, resyncing
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

     Resync Status : 30% complete

              Name : rescue:2
              UUID : 55c6b3c1:32148042:cb720149:39004511
            Events : 8538

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       19        1      active sync   /dev/sdb3

fstab:

# cat /etc/fstab
proc /proc proc defaults 0 0
/dev/md/0 none swap sw 0 0
/dev/md/1 /boot ext3 defaults 0 0
/dev/md/2 / ext4 defaults 0 0

目标是在 md2p2 分区上创建 ZFS 池。该怎么做?

答案1

最后我重新安装了操作系统(按照评论中的建议)。在安装过程中,我将 md2 配置为较小的大小,从而在磁盘上留下未分区的空间。然后,在重新启动后,我创建了新的分区 sda4 和 sdb4(使用 fdisk)并在 中使用它们zpool create

相关内容