Page 1 of 1

Rawdisk on partition

Posted: 20. Sep 2015, 11:48
by Sergio79
I use VirtualBox 5.0.4 on windows 10. When I run the command

VBoxManage internalcommands listpartitions -rawdisk "\\.\PhysicalDrive0"

Show

Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x00 0 /0 /0 0 /0 /0 260 2048
2 0x00 0 /0 /0 0 /0 /0 1474 534528
3 0x00 0 /0 /0 0 /0 /0 260 3553280
4 0x00 0 /0 /0 0 /0 /0 128 4085760
5 0x00 0 /0 /0 0 /0 /0 520085 4347904
6 0x00 0 /0 /0 0 /0 /0 59999 1069481984
7 0x00 0 /0 /0 0 /0 /0 350 1192361984
8 0x00 0 /0 /0 0 /0 /0 27922 1193078784

on partition 6 i want create a rawdisk and i execute commad

VBoxManage internalcommands createrawvmdk -filename "C:\virtualmachines\raw\internalraw.vmdk" -rawdisk "\\.\PhysicalDrive0" -partitions 6

RAW host disk access VMDK file C:\virtualmachines\raw\internalraw.vmdk created successfully.

When I hook the drive to my virtual machine the disk has dimension 596,17 GB as the entire disk.

What am I wrong? because you do not see the partition?

Thanks

Sergio

Re: Rawdisk on partition

Posted: 20. Sep 2015, 12:41
by mpack
Sergio79 wrote:I use VirtualBox 4.5.4 on windows 10.
You do not. There is no such VirtualBox version, at least not from Oracle. Please try to provide accurate diagnostic information. Note also that Windows 10 is not yet a supported host OS, so there is no guarantee that VirtualBox can understand the partitioning scheme used.

There is also the problem that a legacy MBR disk has a maximum of four primary partitions, but you have listed eight. So either you have some secondary partitions in there, or you aren't using MBR. I notice that the type and CHS bytes are all zero, so I suspect perhaps an EFI BIOS. Anyway, either of the latter might be a problem for the rawdisk feature.

A final problem is that a bare partition, even if you can access it, is not bootable, because it is not a complete disk image. You would have to dummy up an MBR, with boot code and a partition map. Are you aware of this?

Re: Rawdisk on partition

Posted: 20. Sep 2015, 13:02
by Sergio79
I'm sorry, my correvt version is 5.0.4. My bios is EFI type.

Even without MBR the display of the disk size should not be correct?

Thanks

Sergio

Re: Rawdisk on partition

Posted: 20. Sep 2015, 13:38
by mpack
VirtualBox will accept the disk size as being whatever the VMDK descriptor says it is; and since the descriptor is just a small text file you can easily check the contents yourself. The disk size will be given (in sectors) in the header. If mapping that bare partition to a VMDK worked correctly, then I'd expect the virtual disk size to be the same size as the partition - not the size of the original disk. And, since it is just a bare partition with no boot sector or partition map, it will not be usable in a VM.

However, I have my doubts whether the VirtualBox createrawvmdk feature was ever intended to work with an EFI BIOS on a Windows host.

Re: Rawdisk on partition

Posted: 20. Sep 2015, 14:56
by Martin
As far as I understand the raw disk access it will always show the whole size of the disk. The -partitions parameter only defines which partitions of the disk should be accessible. You still need to make sure that the partition is not in access by the host, that the guest doesn't try to access the other still visible partitions and to define a replacement mbr file.

Re: Rawdisk on partition

Posted: 20. Sep 2015, 18:10
by Sergio79
There is a way to prove to virtualbox properly partition I want to dedicate?