Accessing raw partitions with VMDK

Categories:  Linux
Labels:  OS, virtualization

I’m trying to access my XP partition with VirtualBox 1.4. The XP partition is on /dev/sda2 and I’d like to access /dev/sda6 as well (documents). I’ve looked in the manual and it seems that the command I need to issue to create the appropriate VMDK file is:

$ VBoxManage internalcommands createrawvmdk -filename /home/user/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2,6 -relative -register

When I do this I get:

Error opening the raw disk: VERR_ACCESS_DENIED

If I add “sudo” in front of the command then it works and the VMDK file is created in /home/user/.VirtualBox/ However when I launch VirtualBox I get a message that tells me this virtual disk is not currently accessible. If I look in virtual disk manager I can see WinXP.vmdk but it has a yellow tag on it.

/dev/sda2 is the partition where XP is installed

/dev/sda6 contains /home (it is also where the vmdk file is stored and this is the partition that I’d like to make accessible to both host and guest)

I also try to remove the /dev/sda6 from the command:

$ sudo VBoxManage internalcommands createrawvmdk -filename /home/user/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register

but I still get the same results…
Is this because I created the VMDK as root (sudo)??
Any idea?

solution:

Postby achimha » 7. Jun 2007, 08:40
You have to change the permissions on /dev/sda2 and /dev/sda6 so that the VirtualBox user can read and write to it.

When creating the VMDK as root, make sure to change owner/permissions so that VirtualBox can access it. Note that creating the VMDK also needs read access to /dev/sda (for the boot sector) so doing this as root is the best solution.

Postby zyzgak » 7. Jun 2007, 12:53
I have similar problem. I’m trying to access my linux partition under XP:

D:\xxx\pc\VirtualBox>VBoxManage internalcommands listpartitions -rawdisk \\.\Phys
 icalDrive1
 VirtualBox Command Line Management Interface Version 1.4.0
 (C) 2005-2007 innotek GmbH
 All rights reserved.

 Number Type StartCHS EndCHS Size (MiB) Start (Sect)
 1 0x83 0 /1 /1 1023/254/63 16386 63
 5 0x07 1023/1 /1 1023/254/63 131006 33559848
 6 0x07 1023/1 /1 1023/254/63 131077 301861413

 D:\xxx\pc\VirtualBox>VBoxManage internalcommands createrawvmdk -filename d:\test1
 .vmdk -rawdisk \\.\PhysicalDrive1 -partitions 1
 VirtualBox Command Line Management Interface Version 1.4.0
 (C) 2005-2007 innotek GmbH
 All rights reserved.

 ERROR: VMDK: could not create new partition data file 'd:\test1-pt.vmdk'
 Error code VERR_SHARING_VIOLATION at E:\vbox\w32-rel\src\VBox\Devices\Storage\Vmd
 kHDDCore.cpp(2228) in function vmdkCreateImage
 Error while creating the raw disk VMDK: VERR_SHARING_VIOLATION

Could somebody point my error? Or, if i have get privileges to access to that partition, how can i achieve this under XP?

Postby kilou » 7. Jun 2007, 13:16
Achimha, how do you change the permissions on /dev/sda2 and /dev/sda6?

My fstab file looks like:

/dev/sda6 /home ext3 defaults 0 2

/dev/sda2 /windows ntfs defaults,nls=utf8,umask=007,gid=46 0 1

Postby achimha » 7. Jun 2007, 13:23
You should not mount those partitions on your host. There must not by any concurrent access.

Use chmod on /dev/sda2 and /dev/sda6 to adjust the permissions.

Postby kilou » 7. Jun 2007, 13:35
chmod seems to be for files and folders only, not for entire partition. And since /dev/sda2 (where windows is installed) is a Ntfs partition, I guess linux can’t change the permission since Ntfs is read-only on linux (except if a specific driver is installed).

All I could find to change the permission is to modify fstab entry for /dev/sda2 and add “uid=1000”……but this means that the xp partition would need to be mounted in linux (this would be required to run chmod as well) :?

I’m a bit confused on how to do that.

Postby moonlight » 7. Jun 2007, 14:44
There is difference between permissions for file system of partition and permissions for partitions itself. Chmod may also work with whole sda

Postby kilou » 7. Jun 2007, 15:14
Can you post an example of the chmod command to issue to set full access permission to /dev/sda2? Does this work also if /dev/sda2 is NTFS?

Related Posts:

Social Profiles

Alvistec spanish
Plan Alvistec in Youtube
Privacy policy

This web site uses third's cookies and the Google's cookies to offer services, personalize ads and analyze traffic (Google analytics).
The information on the use of the this web site is shared with Google and another ads provider platforms. When you using this web site, you accept cookies use.
See more about the Cookies

This web accept cryptocoin donations
BTC address, LTC, ETH, Uphold:
Why donations?