1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
2 | <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
|
---|
3 | <topic xml:lang="en-us" id="rawdisk-access-entire-physical-disk">
|
---|
4 | <title>Access to Entire Physical Hard Disk</title>
|
---|
5 |
|
---|
6 | <body>
|
---|
7 | <p>
|
---|
8 | While this variant is the simplest to set up, you must be
|
---|
9 | aware that this will give a guest operating system direct and
|
---|
10 | full access to an <i>entire physical disk</i>.
|
---|
11 | If your <i>host</i> operating system is also
|
---|
12 | booted from this disk, please take special care to not access
|
---|
13 | the partition from the guest at all. On the positive side, the
|
---|
14 | physical disk can be repartitioned in arbitrary ways without
|
---|
15 | having to recreate the image file that gives access to the raw
|
---|
16 | disk.
|
---|
17 | </p>
|
---|
18 | <p>
|
---|
19 | On a Linux host, to create an image that represents an entire
|
---|
20 | physical hard disk which will not contain any actual data, as
|
---|
21 | this will all be stored on the physical disk, use the
|
---|
22 | following command:
|
---|
23 | </p>
|
---|
24 | <pre xml:space="preserve">$ VBoxManage createmedium disk --filename <varname>path-to-file</varname>.vmdk --format=VMDK
|
---|
25 | --variant RawDisk --property RawDrive=/dev/sda</pre>
|
---|
26 | <p>
|
---|
27 | This creates the
|
---|
28 | <filepath><varname>path-to-file</varname>.vmdk</filepath>
|
---|
29 | file image that must be an absolute path. All data is read and
|
---|
30 | written from <filepath>/dev/sda</filepath>.
|
---|
31 | </p>
|
---|
32 | <p>
|
---|
33 | On a Windows host, instead of the above device specification,
|
---|
34 | for example use <filepath>\\.\PhysicalDrive0</filepath>. On a
|
---|
35 | macOS host, instead of the above device specification use for
|
---|
36 | example <filepath>/dev/rdisk1</filepath>. Note that on Mac OS
|
---|
37 | X you can only get access to an entire disk if no volume is
|
---|
38 | mounted from it.
|
---|
39 | </p>
|
---|
40 | <p>
|
---|
41 | Creating the image requires read/write access for the given
|
---|
42 | device. Read/write access is also later needed when using the
|
---|
43 | image from a virtual machine. On some host platforms, such as
|
---|
44 | Windows, raw disk access may be restricted and not permitted
|
---|
45 | by the host OS in some situations.
|
---|
46 | </p>
|
---|
47 | <p>
|
---|
48 | Just like with regular disk images, this does not
|
---|
49 | automatically attach the newly created image to a virtual
|
---|
50 | machine. This can be done as follows:
|
---|
51 | </p>
|
---|
52 | <pre xml:space="preserve">$ VBoxManage storageattach WindowsXP --storagectl "IDE Controller" \
|
---|
53 | --port 0 --device 0 --type hdd --medium <varname>path-to-file</varname>.vmdk</pre>
|
---|
54 | <p>
|
---|
55 | When this is done the selected virtual machine will boot from
|
---|
56 | the specified physical disk.
|
---|
57 | </p>
|
---|
58 | </body>
|
---|
59 |
|
---|
60 | </topic>
|
---|