Attaching MBR or GPT disk partitions to a VirtualBox VM

On one of my development machines I triple-boot so that I can test in a variety of operating environments. My default is OS X and the other day I wanted to write documentation using DocBook. I knew that my Linux installation already had publican installed and ready to go (publican is a wonderful documentation tool written by Red Hat to facilitate the publishing of DocBook-based documentation) and I really did not want to setup a new Fedora VM that duplicated a setup I already had.

In reality, a new VM would not be all that much effort, but I though it would be really handy to know how to boot a VM up from a physical partition and this way I could kill two birds with one stone. After some research, it seemed using VMWare's VMDK (Virtual Machine Disk Format) images was the most appropriate, as the metadata could be tricked into pointing to physical partitions instead of files. Unfortunately, the tools VirtualBox provide to create them are not compatible with GPT disk tables out of the box. This blog post does mention a trick to convert the VMDK metadata to match the GPT disk layout, but it failed consistently when I tried.

I then, by fluke, found Dave Vasilevsky's vmdk-raw-parts script on GitHub which worked flawlessly! Its usage is well documented so I will not bore you with the details, but with that said after using it to create my custom VMDK, the only change required was to run chmod 666 /dev/diskXsY to grant my user write permissions to the disk (prevents you from having to start VirtualBox as root).

Some Extra Troubleshooting

These details are completely irrelevant to the above, but I wanted to mention them here for others wanting to run the same setup:

  • If you need USB pass-through, remember to set your VCPUs to 1; set it to anything higher and USB stops functioning.
  • You'll need to redo the 'chmod' when ever you reboot your machine, as the permissions on the dev node get reset upon boot.
  • During the trial-and-error process of getting this to work, I often needed to recreate my VMDK and reload it. VirtualBox will moan about mismatched UUIDs... The simple fix is to open File > Virtual Media Manager... to delete then re-add your VMDK file.
Rating: 

Comments

Focused and there's really no room for error if you want to lose a good amount of weight how you doing good I'm really excited form reveal have it really be a surprise because it’s going to be you know ninety days since anybody is seen in Kalispell want to come in the do I came here that Israelis see less the she's on her way here right now the gotta tell yak shit like that a she does it's been crazy year I mean needless to say anybody who goes to a process like this it's a it's tumultuous it's always more than they expect and I'll be honest Eliza she struggled this year she felt so much pressure she does so well in the first 90 days that she almost she became more addicted to the scale that she was to field she fixated on an unfortunate in the in the second phase she began to develop and eating.

Focused and there's really no room for error if you want to lose a good amount of weight how you doing good I'm really excited form reveal have it really be a surprise because it’s going to be you know ninety days since anybody is seen in Kali spell Ketone Slim XT want to come in the do I came here that Israelis see less the she's on her way here right now the gotta tell yak shit like that a she does it's been crazy year I mean needless to say anybody who goes to a process like this it's a it's tumultuous it's always more than they expect and I'll be honest Eliza she struggled this year she felt so much pressure she does so well in the first 90 days that she almost she became more addicted to the scale that she was to field she fixated on an unfortunate in the in the second phase she began to develop and eating.

http://supplementsdietary.com/