Page 1 of 1

Access Raw Vista Partition as VMDK (VB version 3.0.2)

PostPosted: 31. Jul 2009, 13:43
by swlkw97
I have done a lot of research and work trying to get my Vista partition to load in VB but keep hitting roadblocks. I did the following:

1) sudo su
2) umount /dev/sda2
3) chmod 666 /dev/sda2 and sda*
4) VBoxManage internalcommands createrawvmdk -filename /home/steve/virtualbox/vista.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
5) chown steve:users /home/steve/virtualbox/vista.vmdk
6) chown steve:users /home/steve/virtualbox/vista-pt.vmdk

This got me most of the way (i think). I then go into VB and the vmdk partition starts to load. I get the grub error which is to be expected because I have not fixed the MBR. However, if I try loading the vmdk again, I get an error that says:

"Failed to start the virtual machine Windows Vista Virtual.
Medium '/home/steve/virtualbox/vista.vmdk' is not accessible. Could not open the hard disk '/home/steve/virtualbox/vista.vmdk'.
VD: error opening image file '/home/steve/virtualbox/vista.vmdk' (VERR_ACCESS_DENIED)."

So I go back into the terminal and type:

1) sudo su
2) chmod 666 /dev/sd2 or sda*

Then I go to VB and it works (except the grub error). Then I try again and it does not. I have found that I need to type the above two commands into the terminal before I try to access the vmdk via VB each time.

So my questions are:

1) Why to I have to chmod each time I access the file in VB? I feel like I am missing something obvious. How can I avoid/fix this?
2) How can I fix the conflicting vista and grub mbr? I've seen written how to fix it for XP but nothing on vista.

Thanks for any help!


Re: Access Raw Vista Partition as VMDK (VB version 3.0.2)

PostPosted: 2. Aug 2009, 13:52
by TerryE
The issue is one of a user program needing to access a raw partition. This is a restricted operation because having this privilege (1) is a dangerous facility. The simplest programming error or command-line mistype could trash your filesystem, and (2) enabling this allows your program to bypass all Linux security.

The VBox VMM needs such access to get at a raw partition. By default all block devices are in the disk group so the easiest (and somewhat dangerous) way to do this is to add your user account to disk. A safer way is to run this machine in a service account which is in disk. I've have discussed this all before in earlier posts.

In terms of MBR vs Grub, you should have any problems because the VMDK virtualises the boot sector. You install grub in the real boot sector. This is copied to the virtual on in the VMDK, but you can then install the MS MBR bootstrap in the virtual one inside the VMDK when you are booted into a system recovery CD inside your VM.