1

I am trying to install ZFS on a new machine that I got. I am new to ZFS, but I have it running on another server, where I have it on a whole disk. On the current machine that I received there is a more complex setup with two disks in a raid with mdadm.

I am getting this error

# 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:

# 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

# 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

The goal is to create the ZFS pool on the md2p2 partition. How to do it?

  • From the output of the commands it looks like your root filesystem resides on md2 directly without a partition. Did you partition that afterwards? You may also want to add the complete output of the command mount and the /etc/fstab entries. – Thomas Dec 30 '18 at 17:25
  • Looks like an OS reinstall is in your immediate future. Someone screwed up by allocating all the disk to mdraid devices and didn't leave you anything to work with for ZFS. Some other things that will cause you problems are the small root partition and the fact that it was ext4 instead of the expected XFS. – Michael Hampton Dec 30 '18 at 18:33
  • I added full mount and fstab info. I got this setup from a baremetal hosting provider. Is OS reinstall the only way? Is it possible to shrink current partitions to leave space to ZFS? Btw, I reverted the server to original state so current setup doesnt have md2p1/p2 – justadev Dec 30 '18 at 18:45
  • Maybe, with a lot of work. But it would be less work to just reinstall. I haven't yet found a provider who does OS installs properly, and I always recommend people do it themselves. – Michael Hampton Dec 30 '18 at 19:16
  • I dont have access to the servers, and I can only install the OS from the dashboard of the provider, after that I get the above situation with the partitions and mdraid already in place. Can you give the steps that you think it will require to shrink partitions? You can put it in an answer and I will accept it if it works eventually – justadev Dec 30 '18 at 19:57
1

At the end I reinstalled the OS (as suggested in the comments). During installation I configured md2 to a smaller size that left unpartitioned space on the disk. Then after reboot, I created new partitions sda4 & sdb4 (using fdisk) and used them in zpool create.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.