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>While this variant is the simplest to set up, you must be aware that this will give a guest operating system
|
---|
8 | direct and full access to an <i>entire physical disk</i>. If your <i>host</i> operating system is also booted from
|
---|
9 | this disk, please take special care to not access the partition from the guest at all. On the positive side, the
|
---|
10 | physical disk can be repartitioned in arbitrary ways without having to recreate the image file that gives access
|
---|
11 | to the raw disk. </p>
|
---|
12 | <p>On a Linux host, to create an image that represents an entire physical hard disk which will not contain any
|
---|
13 | actual data, as this will all be stored on the physical disk, use the following command: </p>
|
---|
14 | <pre xml:space="preserve">$ VBoxManage createmedium disk --filename <varname>path-to-file</varname>.vmdk --format=VMDK
|
---|
15 | --variant RawDisk --property RawDrive=/dev/sda</pre>
|
---|
16 | <p>This creates the <filepath><varname>path-to-file</varname>.vmdk</filepath> file image that must be an absolute
|
---|
17 | path. All data is read and written from <filepath>/dev/sda</filepath>. </p>
|
---|
18 | <p>On a Windows host, instead of the above device specification, for example use
|
---|
19 | <filepath>\\.\PhysicalDrive0</filepath>. On a macOS host, instead of the above device specification use for
|
---|
20 | example <filepath>/dev/rdisk1</filepath>. Note that on Mac OS X you can only get access to an entire disk if no
|
---|
21 | volume is mounted from it. </p>
|
---|
22 | <p>Creating the image requires read/write access for the given device. Read/write access is also later needed when
|
---|
23 | using the image from a virtual machine. On some host platforms, such as Windows, raw disk access may be restricted
|
---|
24 | and not permitted by the host OS in some situations. </p>
|
---|
25 | <p>Just like with regular disk images, this does not automatically attach the newly created image to a virtual
|
---|
26 | machine. This can be done as follows: </p>
|
---|
27 | <pre xml:space="preserve">$ VBoxManage storageattach WindowsXP --storagectl "IDE Controller" \
|
---|
28 | --port 0 --device 0 --type hdd --medium <varname>path-to-file</varname>.vmdk</pre>
|
---|
29 | <p>When this is done the selected virtual machine will boot from the specified physical disk. </p>
|
---|
30 | </body>
|
---|
31 |
|
---|
32 | </topic>
|
---|