About My Blog



Whenever I get stuck doing something - the time comes to venture in the world of internet to find solution. In most cases I do find the solution, solve my problem and go on with my life. Then one day I am faced with the same problem. But now - I can't remember how the hell I solved it the first time. So the cycle begins again. Then I thought, what if I can remember all the those things? So here it is, my Auxiliary Memory. I decided to save all the problems and their solution in this blog so that I can get back to them when I need them. And the plus point is - so can everybody else.

Friday, October 31, 2014

Accessing Physical Hard Disk Partition From Virtualbox Guest

  1. Run virtualbox with admin privilege.
  2. First we need to find the partition number. For that we need to run the following command.
    "c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internal commands listpartitions -rawdisk "\\.\PhysicalDrive0"
  3. This will show the list of partitions (We need to run command prompt as administrator also for this to work). For my case
    Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
    1       0x07  0   /32 /33  44  /190/18           350         2048
    2       0x07  44  /190/19  1023/254/63        204450       718848
    3       0x07  1023/254/63  1023/254/63         66560    419432448
    4       0x07  1023/254/63  1023/254/63        205578    555747328
  4. Now we need to create a .vmdk file that will point to the partition we need. I am going to attach mine with partition 4.
    "c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internal commands createrawvmdk -filename "E:\VirtualboxVDIs\rawedrive.vmdk" -rawdisk "\\.\PhysicalDrive0"  partitions 4
    RAW host disk access VMDK file E:\VirtualboxVDIs\rawedrive.vmdk created successfully.
  5. Bingo :). Now we need to attach the .vmdk file to a guest OS. Need to run VirtualBox Manager with admin privilege also.
  6. Select the guest OS from virtualbox manager and goto its settings
  7. Select storage tab and add the vmdk file to the SATA controller.
  8. Now startup your guest OS and you will find your hard drive their

One problem with this is that you cannot mount the hard drive in both guest and host at the same time. If your host is windows just remove the drive letter associated with the partition from device manager to unmount it.

Details can be found in this link

No comments:

Post a Comment