Bug #7614

zfs device evacuation/removal

Added by Matthew Ahrens almost 2 years ago. Updated 6 months ago.

Status:ClosedStart date:2018-04-03
Priority:HighDue date:
Assignee:Matthew Ahrens% Done:


Category:zfs - Zettabyte File System
Target version:-
Difficulty:Medium Tags:needs-triage


This project allows top-level vdevs to be removed from the storage pool with “zpool remove”, reducing the total amount of storage in the pool. This operation copies all allocated regions of the device to be removed onto other devices, recording the mapping from old to new location. After the removal is complete, read and free operations to the removed (now “indirect”) vdev must be remapped and performed at the new location on disk. The indirect mapping table is kept in memory whenever the pool is loaded, so there is minimal performance overhead when doing operations on the indirect vdev.

The size of the in-memory mapping table will be reduced when its entries become “obsolete” because they are no longer used by any block pointers in the pool. An entry becomes obsolete when all the blocks that use it are freed. An entry can also become obsolete when all the snapshots that reference it are deleted, and the block pointers that reference it have been “remapped” in all filesystems/zvols (and clones). Whenever an indirect block is written, all the block pointers in it will be “remapped” to their new (concrete) locations if possible. This process can be accelerated by using the “zfs remap” command to proactively rewrite all indirect blocks that reference indirect (removed) vdevs.

Note that when a device is removed, we do not verify the checksum of the data that is copied. This makes the process much faster, but if it were used on redundant vdevs (i.e. mirror or raidz vdevs), it would be possible to copy the wrong data, when we have the correct data on e.g. the other side of the mirror. Therefore, mirror and raidz devices can not be removed.


Bug #9434: Speculative prefetch is blocked by device removal codeClosedAlexander Motin

Related issues

Duplicated by illumos gate - Feature #6903: delphix vdev/device removal/evacuation Closed 2016-04-11


#1 Updated by Yuri Pankov over 1 year ago

  • Duplicated by Feature #6903: delphix vdev/device removal/evacuation added

#2 Updated by Electric Monk 10 months ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit 5cabbc6b49070407fb9610cfe73d4c0e0dea3e77

commit  5cabbc6b49070407fb9610cfe73d4c0e0dea3e77
Author: Prashanth Sreenivasa <pks@delphix.com>
Date:   2018-01-10T16:00:10.000Z

    7614 zfs device evacuation/removal
    Reviewed by: Alex Reece <alex@delphix.com>
    Reviewed by: George Wilson <george.wilson@delphix.com>
    Reviewed by: John Kennedy <john.kennedy@delphix.com>
    Reviewed by: Prakash Surya <prakash.surya@delphix.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Richard Laager <rlaager@wiktel.com>
    Reviewed by: Tim Chase <tim@chase2k.com>
    Approved by: Garrett D'Amore <garrett@damore.org>

Also available in: Atom