Ticket #5582 (new enhancement)
Suggestion: allow disk image data to be aligned in VDI files, for optimal use with SSDs
|Reported by:||Donuts||Owned by:|
First, see this blog post which has some background information: http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-erase-block-size/
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.