-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request: btrfs zerofree #225
Comments
Thank you for your suggestion. I'm not sure why users need to zero their unused blocks. Could you provide more information on the reason behind this? I also looked into your suggestion of using zerofree and it seems like it can be added to partclone. As for alternative solutions, one method is for the user to clone the partition and zero all the blocks before restoring it. This will result in a clear, zeroed partition. Another option is to use ddrescue, such as the command 'ddrescue --force -m domainFile /dev/zero /dev/sdX log.txt', where the domain file can be created by partclone. |
It is like most important feature I was missing in btrfs! Thanks to partclone now it is possible. Most obvious use case - to reduce image size before create dd of entire drive. You zerofree /dev/sda2 then dd if=/dev/sda | gzip > sda.gz Resulting image will be much smaller and easier to send. For example when you want to report issues with btrfs you may want send not 'btrfs send' but actual HDD image. Sure you can use clonezilla or partclone with specific partition. But it would be much easier to zerofree a selected partition before gzipping everying. Another - compacting virtual disk in virtualbox. First stopping virtual machine, then zerofree selected partition. Then run compact on virtual image. This is only been possible for ext4. https://www.google.com/search?q=zerofree+btrfs BTW it is already done in my repo. Only one source file changed - zerofree.c and few Makefiles. Please check url I provided. |
Because the main function of partclone is backup, using zerofree without backup may potentially damage the file system, which poses a significant risk to users. Therefore, regarding the requirement for zerofree, after our discussion, we suggest the following:
We would like to hear your suggestions. Thank you. |
Since partclone is a backup utility better to keep "writing" zerofree as separated binary with different usage screen and options. Booth utilities relay on proper handling data and potentially will cause serious issues, including data loss. I would not make zerofree any special in that case. If a backup weren't a backup - restoring a backup will cause a data loss. |
Hello!
Looking at partclone source code it does the job very well and already has all features for implementing zerofree btrfs utility on top of current source tree.
Can partclone has new option or separate binary for zerofree purpose?
It seems partclone '*bitmap' has used / unused sectors already collected. Only missing zerroing unused sectors option. Implementing option for cleaning unused space would not take much time and can be helpfull for many users / purposes.
EDIT: https://gitlab.com/axet/zerofree-partclone/-/compare/40f45930dff8db08000df3501c27923e70ac4107...master?from_project_id=45986830&straight=false
The text was updated successfully, but these errors were encountered: