Ticket #3718 (closed enhancement: duplicate)
Change the way vdi files are created to allow for later expansion
|Reported by:||GlennCoombs||Owned by:|
|Version:||VirtualBox 2.2.0||Keywords:||vdi expand increase|
From reading the forums it seems like I am just one of many who wants to be able to increase the size of an existing virtual disk image.
After reading http://forums.virtualbox.org/viewtopic.php?t=8046 I think there is an easy solution to the underlying problem of not being able to resize a virtual disk image. As I understand it the vdi consists of a 512 byte header followed by the block image map, followed by the image blocks. Currently the block image map is sized according to how large the user has said they want the image to be.
If the user later says they want the image to be larger then all the image blocks would need to be moved up in the file in order to make room for the extra blocks that are now required in the block image map. This could result in having to copy many gigabytes of data around and would be very slow.
What would happen if the vdi files were always created with a minimum size of 4M for the block image map (i.e. enough blocks to access 1 terabyte of image data) ? If an extra field was added to the header to specify the current size of the simulated disk then expanding the size of an existing vdi would be as simple as updating the new header entry to reflect the new larger disk size. Obviously this would only work so long as the new size is less than 1 terabyte but that would almost certainly be good enough for the majority of users who currently hit this problem.
Or have I missed something obvious here ?