#14977 closed enhancement (wontfix)
Compacting encrypted VDI
Reported by: | i8329 | Owned by: | |
---|---|---|---|
Component: | virtual disk | Version: | VirtualBox 5.0.12 |
Keywords: | Cc: | ||
Guest type: | all | Host type: | all |
Description
I am doing the following steps to compact VDI:
- Clean disk
- Defragment disk
- Zero free space
- Compact VDI
It works for unencrypted VDI.
For encrypted VDI: At step 3 disk size grows to maximum size. At step 4 disk size does not reduce.
Evidently, this happens because zero blocks are encrypted. I think the problem could be solved if VirtualBox encrypted only non-zero blocks.
Change History (4)
comment:1 by , 8 years ago
Guest type: | Windows → all |
---|---|
Host type: | Windows → all |
priority: | major → minor |
Resolution: | → wontfix |
Status: | new → closed |
Type: | defect → enhancement |
follow-up: 4 comment:2 by , 5 years ago
I guess that a workaround to this would be to add 2 steps to the above procedure:
- Clean disk
- Defragment disk
- Zero free space
- Unencrypt disk
- Compact VDI
- Encrypt disk
Can anyone confirm that this works ?
comment:3 by , 5 years ago
@gggeek, I don't see why it wouldn't.
But remember, at the "Zero free space" step your VDI will increase to its maximum size, make sure you have the space for it. Because usually people remember to shrink their VDIs when they run out of space...
comment:4 by , 5 years ago
Replying to gggeek:
I guess that a workaround to this would be to add 2 steps to the above procedure:
- Clean disk
- Defragment disk
- Zero free space
- Unencrypt disk
- Compact VDI
- Encrypt disk
Can anyone confirm that this works ?
I tested this and can confirm that it does NOT work this way. The compacted VDI expands to full size when re-encrypting.
This will not be implemented in the foreseeable future. The encryption of the guest data is done very early so the disk format backends never sees the unencrypted data to omit writing zero blocks. This would also result in a mix of unencrypted (although the data consists of just zeros) and encrypted data in the final disk image which we don't want.