Internal Card Reader - Not USB - Windows 7 Host
My laptop has a built-in Card Reader and doesn't appear as a USB device. To get it to work I had to mount the EXT4 partition as RAW before assigning it to the VM and then booting the VM.
First thing I noticed was if I opened the Disk Management utility under Computer Management - Right click on My Computer and select Manage you should be able to see the SD card as a disk and as Kibbee mentioned mine also had three partitions, I guessed the larger middle partition is the one that I was after.
To mount the raw partition within VirtualBox you need to know the disk & partition number. I confirmed these first using the windows command line utility Diskpart and the list disk
command (on my laptop, and in Disk Management, the SD Card appeared as #1)
To identify the partitions correctly, I used the VirtualBox command listpartitions
here's mine as an example:
vboxmanage internalcommands listpartitions -r awdisk \\.\PhysicalDrive1
And the output for me was:
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x0c 16 /0 /1 1023/3 /32 75 2048
2 0x83 1023/3 /32 1023/3 /32 1590 157696
3 0x82 1023/3 /32 1023/3 /32 191 3416064
From this I'm guessing the partition 2 is the EXT4 partition I'm trying to get access to.
Mounting the Partition as a raw volume
To make the raw partition available to the Linux guest, VirtualBox allows you to submit the createrawvmdk
command which creates a file with a .vmdk extension that you can then specify as an existing disk from the VM's storage settings. Again, here's mine as an example:
vboxmanage internalcommands createrawvmdk -filename
C:\VirtualMachines\Debian\disk1_part2.vmdk -rawdisk \\.\PhysicalDrive1
-partitions 2
(you can leave out the "-partitions 2" parameter to enable all partitions on the device.)
Adding the raw disk to the VM
Before starting the VM
- Open the VM's Settings dialog, select Storge
- Right click SATA Controller and click Add Hard Disk
- Select the Choose Existing Disk button and browse to the file created in the previous step.
You're now be able to boot the VM and have access to the EXT4 partition.
Problems with User Account Control
If the following conditions are met:
- the host system is running Windows Vista, 7 or 8 (or perhaps Windows
Server 2008R2/2012)
- User Account Control is enabled
- and you haven't modified permissions regarding raw disk access
then the above operation might fail, even if you're an Administrator.
This is due to the fact that non-administrators will not have access to raw devices.
I see 4 possible solutions, none of which are very nice:
- Disabling User Account Control might fix it (I haven't tested that).
- It might be possible to assign permissions for users to access raw devices; however I wouldn't recommend this as it's extremely insecure.
- You can run VirtualBox as an Administrator (right click, select "Run as administrator"); you have to do this both while creating and using the device.
- ....or buying a USB card reader and attach it directly as a USB device.