Split a ZFS mirror, then recombine it?

I have a 4tb zfs mirror which is difficult to mount because of a problem that occurred when it was first made. I think the best way to fix it is just to start over.

My idea is to pull one of the disks from the mirror, create a new zfs pool on that disk then move everything from the original on to the new one and add that disk to the new pool as a mirror. Will this work?

Most ZFS upgrades and changes I have read about are all make a new pool and move the data over so you're doing the write thing.

As too degrading the pool by removing a drive I guess it will work but fingers crossed no drive failures and data loss.

Degrading the pool will work, it's making an single disk pool and then adding a drive to it to make a mirror that I'm unsure about

I think in the mirror situation you will be alright with your plan.

Welp, it's happening so I'll see how I go

2 Likes

HD are pretty reliable once there through the first week of use. Im sure it will be ok. Famous last works :slight_smile:

Yep, worked fine.

I I wasn't sure if you could create a mirror without wiping the data but there's no problem. Just copied the data from the old degraded pool to the new single disk pool then ran zpool attach to put the old disk in to the new pool and it resikvered it into a mirror no problems.

Real quick, could you just post the result of a zpool status for me right quick? I can see how setting up a mirror after the fact would theoretically be possible, but I worry. In your screenshot above, you have

sudo zpool create -o ashift=12 zpool1 /dev/mapper/downloads1 -f

This would create a striped set, effectively a RAID 0. I worry that adding the disk has created a 2 disk RAID 0 rather than a 2 disk RAID 1.

That command just created a single disk (non redundant) volume called zpool 1 on /dev/mapper/downloads1. After that I used syncoid (which uses zfs send / recv) to copy the data from the original (degraded) pool on /dev/mapper/downloads2.

Once that was done I exported the original pool and ran:

zpool attach zpool1 /dev/mapper/downloads1 /dev/mapper/downloads2

That added the second disk to it and changed it from a non redundant single disk pool to a mirror and automatically started resilvering the pool.

pool: zpool1
 state: ONLINE
  scan: resilvered 1.46T in 3h3m with 0 errors on Wed May 31 05:06:55 2017
config:

        NAME            STATE     READ WRITE CKSUM
        zpool1          ONLINE       0     0     0
          mirror-0      ONLINE       0     0     0
            downloads1  ONLINE       0     0     0
            downloads2  ONLINE       0     0     0
        logs
          zil           ONLINE       0     0     0
        cache
          cache         ONLINE       0     0     0

errors: No known data errors
1 Like

Very nice! I keep waiting for the other shoe to drop with ZFS, but it remains a file system to be reckoned with.

I'm almost tempted to convert all my storage to zfs

Happy to see you figured that out :slight_smile:

For people interested in re-purposing zpool disks: you can use "zpool labelclear /dev/......" to clear all ZFS labels on a disk. That gives you the extra dot of certainty it won't get mixed up e.g. if you have to mount it inside a machine and cold boot it.

1 Like