0

Currently I'm running a ZFS striped mirror set:

NAME                                            STATE     READ WRITE CKSUM
data                                            ONLINE       0     0     0
  mirror-0                                      ONLINE       0     0     0
    gptid/cfa8a519-5f83-1ce1-a581-c9c8fccbd20a  ONLINE       0     0     0
    gptid/f5d15303-c826-ad69-ee88-ad3a8fc2460c  ONLINE       0     0     0
  mirror-1                                      ONLINE       0     0     0
    gptid/13f52f4c-bb95-dfca-844b-db46d766c808  ONLINE       0     0     0
    gptid/21ddf484-33ad-6f43-c191-9f7ce4070677  ONLINE       0     0     0

mirror-0 and mirror-1 are striped. But I want to change it to a 2-disk setup, which is in mirror. Because the 2 disks in mirror-1 set are the biggest, I want to keep that mirror set. But I guess mirror-0 set contains data that is not stored in mirror-1 set.

So short question is, how do I change my config to a 2 disk mirror setup without losing data?

Thanks in advance!

2 Answers2

3

Currently you cannot remove VDEV's. If you want to remove mirror-0, you basically have to make a backup, then re-create your pool, and restore.

Zoredache
  • 130,897
  • 41
  • 276
  • 420
1

This is actually possible with OpenZFS v2.1+

The manpage of zfs-remove states

This command supports removing hot spare, cache, log, and both mirrored and non-redundant primary top-level vdevs, including dedup and special vdevs.

However some restrictions apply:

Top-level vdevs can only be removed if the primary pool storage does not contain a top-level raidz vdev, all top-level vdevs have the same sector size, and the keys for all encrypted datasets are loaded.

According to that you should be able to shrink your pool by e.g. mirror-1 by issuing zfs remove data mirror-1 as long as the above restrictions are met and the remaining pool is big enough to hold all data

See https://openzfs.github.io/openzfs-docs/man/v2.1/8/zpool-remove.8.html