SD Card Mount in VirtualBox
Posted on Fri 13 October 2017 in macosx
VirtualBox on MacOS
When using VirtualBox on MacOS it is a little bit tricky to mount an SD card in a linux VM. Since it cannot be done directly, a mapping between the SD card and a raw disk must be created.
Preparing a Link between the SD Card and a Raw Disk
First, insert the SD card in the card reader or the card reader slot on your Mac. Then, make use of the disktutil
command to get the id of the SD card:
diskutil list
In the following it is assumed that the SD card is attached as /dev/disk3
. Make sure to adapt the disk ID to your configuration to avoid damages to the wrong disk!!!
Unmount the SD card from MacOS so that it can be accessed by VirtualBox:
diskutil unmountDisk /dev/disk3
In the next step, a mapping between a raw VDMK file and the SD card must be created using the VBoxManage
command:
sudo VBoxManage internalcommands createrawvmdk -filename sdcard.vmdk -rawdisk /dev/disk3
Make sure that the newly created mapping file as well as the original disk device can be accessed by the normal user:
sudo chmod 666 sdcard.vmdk
sudo chmod 666 /dev/disk3
VirtualBox Configuration
Subsequently, the created disk must be attached to the VM. To do so, make sure that the VM is powered off. Then, open the settings of the VM and select the Storage Tab. Add a new SATA Controller and add a new harddisk to it by selecting the previously created sdcard.vmdk
image. Click OK to confirm the changes to the settings.
Start the VM and the SD card should appear as normal disk in the system.