How To Create VDI from Bootcamp Partition
Posted: 13. Jun 2012, 09:34
Posting here to benefit others in the community.
The attached Perl script will allow you to create a VDI file from a Boot Camp partition.
The script is offered as is but I have tested it with Windows XP and Windows 7 partitions of various sizes and formats.
The script was put together after much research and trail and error so you will probably notice unneeded portitions in it. Although it could be improved to truly optimize the partitions being copied. I did try as much as possible to mimic how Windows formats and sets up a drive in creating the VDI files.
This was built for OS X but I am sure it could be easily tweak to work on Linux.
The script has to run with sudo because the partition cannot be accessed by dd without elevated privileges or changing the file permissions.
The script has three options:
-v : verbose
-l : force it to treat the partition as a pre-Windows 2000 install. This just means that it won't add in the "unused space" for dynamic drive conversion that is normal in recent Windows installs
--noboundaryadjustment : This just tells it that within the VDI disk, the partition doesn't have to end on a cylinder boundary. Windows XP when doing installs will make the partition end on a cylinder boundary. It isn't absolutely necessary though.
I hope others find this script useful. I will try to monitor this topic in case people have questions.
The attached Perl script will allow you to create a VDI file from a Boot Camp partition.
The script is offered as is but I have tested it with Windows XP and Windows 7 partitions of various sizes and formats.
The script was put together after much research and trail and error so you will probably notice unneeded portitions in it. Although it could be improved to truly optimize the partitions being copied. I did try as much as possible to mimic how Windows formats and sets up a drive in creating the VDI files.
This was built for OS X but I am sure it could be easily tweak to work on Linux.
The script has to run with sudo because the partition cannot be accessed by dd without elevated privileges or changing the file permissions.
The script has three options:
-v : verbose
-l : force it to treat the partition as a pre-Windows 2000 install. This just means that it won't add in the "unused space" for dynamic drive conversion that is normal in recent Windows installs
--noboundaryadjustment : This just tells it that within the VDI disk, the partition doesn't have to end on a cylinder boundary. Windows XP when doing installs will make the partition end on a cylinder boundary. It isn't absolutely necessary though.
I hope others find this script useful. I will try to monitor this topic in case people have questions.