-
Notifications
You must be signed in to change notification settings - Fork 142
Issue with moving sparse files with tmpfs_workspace plugin #442
Comments
Heh, I mean there's a really obvious solution here: Change the order :-) |
Changing the order is an obvious one, but I do not know bootstrap-vz internals well enough and assumed that we are not supposed to touch the image after it has been moved to the final destination and we can "touch" the image only when it is in the temporary directory. |
No you're right. It's not a rule per se, but it would definitely be something one would expect. I think we need to find another solution. |
Probably this issue has a very narrow impact - it affects only if three conditions are met:
Maybe it's enough just to add a notice in tmpfs_workspace or minimize_size plugin documentation that in this combination raw images are not shrunk. |
Ideally one could just add a check to |
Some notes. Starting from Python 3.5, |
There is an issue with copying sparse files (e.g.
raw
format truncated withminimize_size
plugin /yep, shrinking plugin supports raw, see PR #441/) when using plugintmpfs_workspace
: files are moved from temporary to final destination as a normal, not sparsed file.I think it is because the file crosses filesystem boundaries and looks like Python function
shutil.move()
does not support sparse files in this case.bootstrap-vz/bootstrapvz/common/tasks/image.py
Line 17 in a449d35
It does not affect formats that do not use sparse files but just truncates original size (e.g.
qcow2
).I do not know if we can do something about it. Workaround is to use
fallocate --dig-hole <file>
or use Python code to "punch hole" after moving the image to final destination, see: https://unix.stackexchange.com/questions/52012/can-a-file-that-was-originally-sparse-and-expanded-be-made-re-sparse/105948Log with with added
du -m
- it's easy to see where we lost sparse:Pinging @liori just in case.
BTW: In my case
tmpfs_workspace
plugin boosts building image from 3m30s to 2m10s (SSD-backed VM).The text was updated successfully, but these errors were encountered: