Accessing raw partitions with VMDK (VirtualBox 1.4)
Accessing raw partitions with VMDK (VirtualBox 1.4)
Hi,
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?
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?
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.
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.
I have similar problem. I'm trying to access my linux partition under XP:
Could somebody point my error? Or, if i have get privileges to access to that partition, how can i achieve this under XP?
Code: Select all
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
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.
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.
First make sure /dev/sda2 and /dev/sda6 are not mounted. Then issue as root:
Of course 777 is not the best solution but it will show you the direction.
Code: Select all
chmod 777 /dev/sda2
chmod 777 /dev/sda6
Thanks achimha but I still have the same problem. I did:
1) unmount /dev/sda2
2) sudo chmod 777 /dev/sda2
3) sudo VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
...and virtualdisk manager still warns that the registred virtual hardisk is not accessible.
1) unmount /dev/sda2
2) sudo chmod 777 /dev/sda2
3) sudo VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
...and virtualdisk manager still warns that the registred virtual hardisk is not accessible.
Try this:kilou wrote:Thanks achimha but I still have the same problem. I did:
1) unmount /dev/sda2
2) sudo chmod 777 /dev/sda2
3) sudo VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
...and virtualdisk manager still warns that the registred virtual hardisk is not accessible.
1) sudo su
2) umount /dev/sda2
3) chmod 666 /dev/sda*
4) VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
5) chown kilou:users /home/kilou/.VirtualBox/WinXP.vmdk
6) exit
Each time you recreate the vmdk you will need to re-register it. VBox keeps a hash(MD5?) of somekind and if the file is replaced, even if the name is the same, you have to delete it from the Virtual Disk Manager and add it again.kilou wrote:Thanks achimha but I still have the same problem. I did:
1) unmount /dev/sda2
2) sudo chmod 777 /dev/sda2
3) sudo VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
...and virtualdisk manager still warns that the registred virtual hardisk is not accessible.
Still no luck on my side I did:
1) sudo su
2) umount /dev/sda2
3) chmod 666 /dev/sda2 (also tried with 777)
4) VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
5) chown kilou:users /home/kilou/.VirtualBox/WinXP.vmdk
Now I don't get any message when starting VirtualBox but when I launch virtual disk manager it is empty (the created vmdk disk is not registred?). I tried to click "Add" and then there are 2 vmdk files: WinXP.vmdk and WinXP-pt.vmdk. Selecting either of those files makes a popup message appear saying:
##############################################
Failed to register the hardisk /home/kilou/.VirtualBox/WinXP.vmdk
Could not access hard disk image /home/kilou/.VirtualBox/WinXP.vmdk
(VERR_VDI_INVALID_SIGNATURE)
Result Code:
0x80004005
Component:
HardDisk
Interface:
IHardDisk {fd443ec1-000f-4f5b-9282-d72760a66916}
Callee:
IVirtualBox {d1a2295c-d257-4a4c-a9a6-843d87db6f45}
###############################################
I tried to do the same but creating a vmdk file with another name but I still can't access it.
1) sudo su
2) umount /dev/sda2
3) chmod 666 /dev/sda2 (also tried with 777)
4) VBoxManage internalcommands createrawvmdk -filename /home/kilou/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
5) chown kilou:users /home/kilou/.VirtualBox/WinXP.vmdk
Now I don't get any message when starting VirtualBox but when I launch virtual disk manager it is empty (the created vmdk disk is not registred?). I tried to click "Add" and then there are 2 vmdk files: WinXP.vmdk and WinXP-pt.vmdk. Selecting either of those files makes a popup message appear saying:
##############################################
Failed to register the hardisk /home/kilou/.VirtualBox/WinXP.vmdk
Could not access hard disk image /home/kilou/.VirtualBox/WinXP.vmdk
(VERR_VDI_INVALID_SIGNATURE)
Result Code:
0x80004005
Component:
HardDisk
Interface:
IHardDisk {fd443ec1-000f-4f5b-9282-d72760a66916}
Callee:
IVirtualBox {d1a2295c-d257-4a4c-a9a6-843d87db6f45}
###############################################
I tried to do the same but creating a vmdk file with another name but I still can't access it.