4

I did a mistake when I added a new device in my raidz pool thinking ZFS should do it automatically.

 :~# zpool status
  pool: data
 state: ONLINE

 scan: resilvered 78,3G in 2h4m with 0 errors on Tue May 10 18:12:31 2016
config:

    NAME         STATE     READ WRITE CKSUM
    data         ONLINE       0     0     0
      raidz2-0   ONLINE       0     0     0
        c2t2d0   ONLINE       0     0     0
        c2t3d0   ONLINE       0     0     0
        c2t4d0   ONLINE       0     0     0
        c2t5d0   ONLINE       0     0     0
        c2t6d0   ONLINE       0     0     0
        c2t7d0   ONLINE       0     0     0
        c2t8d0   ONLINE       0     0     0
        c2t9d0   ONLINE       0     0     0
        c2t10d0  ONLINE       0     0     0
        c2t11d0  ONLINE       0     0     0
      c2t13d0    ONLINE       0     0     0
    spares
      c2t12d0    AVAIL   
      c2t14d0    AVAIL 

I'm thinking c2t13d0 is not in the raidz pool, is it? How to remove it form the data pool ?

Thank for any help.

3
  • 2
    To go along with the two answers below (back up, destroy pool, create new pool, restore), you should be aware that ZFS cannot add disks to a raidz group. The only way to make a ZFS pool have more capacity is by adding new toplevel vdevs. You may want to consider two raidz2 toplevels instead of a single giant one.
    – mmusante
    Commented Jun 14, 2016 at 10:23
  • 1
    As has been pointed out, you cannot remove a vdev from a pool. I suspect that, but don't know if, you can use file-backed pools on OpenSolaris. If you can, that's a good way to set up a test environment where you can try things out without risk of problems. (I suspect you also had to use -f to force the vdev add operation, which should have been all the warning needed...)
    – user
    Commented Jun 14, 2016 at 13:24
  • @mmusante you can also replace all the drives in a vdev with larger drives, one by one. When they've all been replaced, the extra capacity will become available.
    – cas
    Commented Jun 15, 2016 at 0:17

2 Answers 2

7

You can't. It's now in the pool as a single-drive vdev. vdevs can not be removed from a pool.

That's the bad news.

The worse news is that you've now effectively got a RAID-0 with your raidz2-0 vdev and the c2t13d0 vdev. This is NOT good. It's doubleplusungood.

Your options are:

  • to live with the pool you have created
  • backup, destroy and re-create the pool, and restore.

Neither option is good. backup/recreate/restore is the right option in the long run, but requires significant downtime (the only way to avoid that is to create a SECOND pool of the same size or larger and zfs send to that).


BTW, one thing can do to fix the lack of redundancy is to attach a mirror to the c2t13d0 vdev. Maybe use one of the spares if they're the same size.

Use something like:

zpool attach data c2t13d0 anotherdisk

It's far from ideal but a RAIDZ2 vdev striped with a mirror vdev has redundancy (still an abomination but not one that's going to eat your data), while RAIDZ2 striped with a single-drive doesn't have any reliable redundancy (some of your data will be ONLY on the single-drive vdev. This will invariably turn out to be your most valuable and irreplaceable data).

It does make the first option ("live with it") suck a lot less...at least for now. In the long run, you'll want to rebuild your pool.

I don't have access to the Solaris man page, but here's a relevant extract from the ZFS On Linux version of the zpool man page (bolding added by me for emphasis). Solaris version should be the same or very similar:

zpool attach [-f] [-o property=value] pool device new_device

Attaches new_device to an existing zpool device. The existing device cannot be part of a raidz configuration. If device is not currently part of a mirrored configuration, device automatically transforms into a two-way mirror of device and new_device. If device is part of a two-way mirror, attaching new_device creates a three-way mirror, and so on. In either case, new_device begins to resilver immediately.

0
0

You're right, your pool comprises of two vdevs, the disk c2t13d0 and raidz2-0, which are striped.

Unfortunately ZFS doesn't (yet) offer a possibility to remove a vdev from a pool. So your only option is to destroy the pool, recreate it and restore from backup.

1
  • This is possible in 2023 (and at least 2 years ago). You can remove single-drive and mirrored vdevs. You still cannot remove RAID-Z.
    – Sawtaytoes
    Commented Oct 17, 2023 at 3:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .