4

Let me just paint the picture so you can all understand.

My host OS is Windows 10. I have VirtualBox installed on my Windows OS, and in VirtualBox I have a Kali distro running. This VM and its files are located on my external HDD.

There is a partition on my external HDD which I want to access through my Kali Linux VM.

Adding the external HDD to the virtual machine as a USB device isn't possible, since it would completely disconnect from my host Windows OS and then of course VirtualBox wouldn't be able to access this machine anymore.

Sharing a folder isn't possible since I cannot actually locate this partition from within my Windows host OS.

Is there any work-around possible to access this partition while I'm in Kali Linux, that doesn't involve copying the VM folder to another HDD?

External HDD partition layout is like this:

--- D:/   (Here resides a backup of my Windows host OS)
--- E:/   (Partition where I keep the VirtualBox hard disk file of Kali Linux)
---- HIDDEN ---- (This is the hidden encrypted partition formatted EXT3)
--- F:/   (Partition with games)
8
  • 1
    How comes windows into play? Is that the host OS? If so what does it mean when you write "where I run Kali Linux": that is where the virtualbox files for Kali Linux are? What program/OS has access to the drive since it is not Windows and also not Kali from your question? Please update your question to make your setup more clear and unambiguous.
    – Anthon
    Feb 1, 2016 at 19:44
  • @Anthon Edited the post, hopefully you understand it now.
    – Dennis1679
    Feb 1, 2016 at 19:54
  • If you clarified why you can't access the partition from your host OS then people might be able to help, or direct you to Super User if this turns out to be a Windows question. If you definitely don't want to use a share, then consider raw raw hard disk access. Feb 1, 2016 at 20:12
  • I did clarify that. As I see it, there are two ways of connecting a partition to a virtual machine. Adding the whole external disk as a USB device or sharing the partition with the virtual machine. The first one won't work as I explained. The second one, I cannot do, because there is no way I know of to actually let this partition show up on my Host OS.. (because it is formatted as a linux partition)
    – Dennis1679
    Feb 1, 2016 at 20:15
  • @Dennis1679 Not entirely clear. How can you currently access the data on that partition? If you can from windows, just share it with the client in Virtualbox, if you cannot tell us how you can access it when virtualbox is not running.
    – Anthon
    Feb 1, 2016 at 20:27

1 Answer 1

5

Assuming you have sufficient access rights to the device, you should be able to access the hidden partition from the VM by creating a special vmdk file that will map the raw partition to a virtual device.

You need to first identify the wanted partition with something like:

C:\Program Files\Oracle\VirtualBox> VBoxManage internalcommands listpartitions -rawdisk \\.\physicaldriveX

Replace X by the disk identifier (0 is the first internal).

This will show a table with all partitions of the disks, the first columns shows the partition number.

Then, assuming you want to access partition #3 on disk #2, you can create the vmdk file with this command:

C:\Program Files\Oracle\VirtualBox> VBoxManage internalcommands createrawvmdk -filename "C:\Users\Dennis\VirtualBox VMs\kali\part3.vmdk" -rawdisk \\.\PhysicalDrive2 -partitions 3

The part3.vmdk file might then be added as a new device to your VM.

As with any commands dealing with raw disk access, I would strongly recommend doing proper backups of anything valuable present on your disks before attempting this as any mistake might destroy your data/file systems. Especially, having the same file system mounted simultaneously by multiple OSes will quickly corrupt it.

References:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .