Several questions about "zfs rewrite" #17743
Replies: 1 comment 10 replies
-
|
Since you have used raidz expansion, it might be reasonable to rewrite all your data at some point in some way to get better space efficiency. But it has to be done in coordination with your snapshot retention policy, since until your oldest snapshots rotate you may have a double space usage on the pool as result of rewrite. Rewrite in its current implementation works on mounted datasets. It is not a strict requirement in general, but that is what is is now. If you need it for unmounted datasets, then send/receive/destroy might be a better alternative. Rewrite theoretically might reduce fragmentation, but it might be not very predictable. Fragmentation metrics for the pool is a free space fragmentation. There is no metrics for data fragmentation, so attempt to rewrite everything blindly might make is either better or worse. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My questions are:
I have a pool with a single raidz2 vdev. I expanded it from 5 disks to 6 disks several months ago using the
zfs attachcommand. However the existing data are not rebalanced and thus there is a space loss. I learnt that the newrewritesubcommand can solve this, but how? My pool, namedData, is mounted at/mnt/Data. One of its sub-datasets,Backups, contains replication data (snapshots) from other pools that was sent viazfs send ... | zfs receive ...; it is not mounted since the data inside should remain untouched by anyone else. Meanwhile, all other (sub-)datasets are mounted recursively and have got snapshots recursively; I use the toolzreplto create new snapshots every hour for data safety concerns. If the rewrite command is subject to files, what should I do to thisBackupdataset and all other snapshots? Shall I stopzreplfrom generating new snapshots during the rewrite process?The root file system of my server is also in a pool named "System" and it has also got snapshots recursively, auto-generated by
zrepl. It is too fragmented now (the value of thefragmentationattribute is over 40%). Can I use therewritesubcommand to solve this? If yes, how? How to deal with the snapshots and should I stopzreplduring the rewrite process? Is it possible to set up a cron job, etc. to defragment automatically from time to time?ps. The
zfs rewritesubcommand was introduced just 20 days ago, and all the articles I can find on the Internet are talking about what can it do instead of how to achieve a goal using it; even the official wiki has no examples at all. :(Beta Was this translation helpful? Give feedback.
All reactions