Ticket #5582 (new enhancement)

Opened 7 years ago

Last modified 7 years ago

Suggestion: allow disk image data to be aligned in VDI files, for optimal use with SSDs

Reported by: Donuts Owned by:
Priority: minor Component: other
Version: VirtualBox 3.0.12 Keywords:
Cc: Guest type: other
Host type: other


First, see this blog post which has some background information:

In summary, the smallest chunk of data that SSDs (solid-state flash drives) can write is larger than the 512-byte size that the SSD emulates/fakes for the host computer. The smallest chunk size might be 4KB, for example. If filesystem writes are not aligned to 4KB boundaries performance will suffer, especially for first-generation SSDs.

For example, if the host computer writes 4KB to (512-byte) sectors 63 to 70, the SSD will read the 4KB corresponding to sectors 56-63, update the sector 63 data and write it to flash. Similarly with the 4KB block corresponding to sectors 64-71. This read-modify-write causes more wear on the SSD.

Windows XP and earlier (and probably most non-Windows partitioning software) by default creates the first partition starting at (512-byte) sector 63. That is an "odd" alignment, not aligned on a 1KB boundary let alone 4KB or more.

What does this have to do with VirtualBox? My suggestion is that the VDI format be updated to allow the user to specify the alignment of the data. VirtualBox would add a few sectors worth of padding before the actual data. For use with SSDs, the user could set the alignment so sector 63 is on a 4KB boundary in the VDI file. The fixed-size VDI header appears to be $600 bytes long, so an extra $C00 bytes padding would be needed in that case. Doing that might also be a minor performance win for conventional hard drives, if the host filesystem uses a 4KB cluster size. Of course the exact amount of padding to use needs to be user-configurable; for a Vista VDI it would be $A00 bytes.

Change History

comment:1 Changed 7 years ago by Donuts

I have posted instructions on how to manually add padding to a new (dynamically-expanding) VDI file to

Contrary to what I wrote about SSDs above, this is also relevant to conventional hard disks. The issue is that the guest filesystem clusters (typically 4KB) may not be aligned on a cluster boundary in the host partition.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use