Sun Microsystems VIRTUALBOX VERSION 3.1.0_BETA2 User Manual

Page 146

Advertising
background image

9 Advanced topics

arbitrary ways without having to recreate the image file that gives access to the raw
disk.

To create an image that represents an entire physical hard disk (which will not

contain any actual data, as this will all be stored on the physical disk), on a Linux
host, use the command

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk

-rawdisk /dev/sda

This creates the image /path/to/file.vmdk (must be absolute), and all data will
be read and written from /dev/sda.

On a Windows host, instead of the above device specification, use e.g.

\\.\PhysicalDrive0

. On a Mac OS X host, instead of the above device speci-

fication use e.g. /dev/disk1. Note that on OS X you can only get access to an entire
disk if no volume is mounted from it.

Creating the image requires read/write access for the given device. Read/write

access is also later needed when using the image from a virtual machine.

Just like with regular disk images, this does not automatically register the newly cre-

ated image in the internal registry of hard disks. If you want this done automatically,
add -register:

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk

-rawdisk /dev/sda -register

After registering, you can assign the newly created image to a virtual machine with

VBoxManage modifyvm WindowsXP -hda /path/to/file.vmdk

When this is done the selected virtual machine will boot from the specified physical
disk.

9.11.2 Access to individual physical hard disk partitions

This “raw partition support” is quite similar to the “full hard disk” access described
above. However, in this case, any partitioning information will be stored inside the
VMDK image, so you can e.g. install a different boot loader in the virtual hard disk
without affecting the host’s partitioning information. While the guest will be able to
see

all partitions that exist on the physical disk, access will be filtered in that reading

from partitions for which no access is allowed the partitions will only yield zeroes, and
all writes to them are ignored.

To create a special image for raw partition support (which will contain a small

amount of data, as already mentioned), on a Linux host, use the command

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk

-rawdisk /dev/sda -partitions 1,5

146

Advertising