{"repo":"markusressel/zfs-inplace-rebalancing","free":true,"listed":false,"github":"https://github.com/markusressel/zfs-inplace-rebalancing","clone":"git clone https://github.com/markusressel/zfs-inplace-rebalancing.git","description":"Simple bash script to rebalance pool data between all mirrors when adding vdevs to a pool.","language":"Shell","stars":786,"topics":["zfs","balancing","bash","inplace","zfsonlinux","script"],"license":"CC0-1.0","category":"cli-tools","readme_excerpt":"zfs-inplace-rebalancing Simple bash script to rebalance pool data between all mirrors when adding vdevs to a pool. [!IMPORTANT] ZFS 2.3.3 introduced the zfs rewrite command, which is meant to address this very issue as well, but avoids most of the caveats the script in this repository has. Definitely check it out first before trying to make this script work for you. PR: https://github.com/openzfs/zfs/pull/17246 Docs: https://openzfs.github.io/openzfs-docs/man/master/8/zfs-rewrite.8.html How it works This script recursively traverses all the files in a given directory. Each file is copied with a .balance suffix, retaining all file attributes. The original is then deleted and the copy is renamed back to the name of the original file. When copying a file ZFS will spread the data blocks across all vdevs, effectively distributing/rebalancing the data of the original file (more or less) evenly. This allows the pool data to be rebalanced without the need for a separate backup pool/drive. When the script detects an inode group of hardlinked files, it will proceed to copy one file in the inode group. The original file and all hardlinks are then deleted, the copy is renamed back to the name of the original file, and new hardlinks are generated from that copy to replace all other linked files that were removed. The way ZFS distributes writes is not trivial, which makes it hard to predict how effective the redistribution will be. See: - https://jrs-s.net/2018/04/11/zfs-allocates-writes-a","default_branch":null,"files":null,"tree":[],"storefront":"/r/markusressel","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/markusressel/zfs-inplace-rebalancing/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}