creating image from SD card and using it with VM

This is for discussing general topics about how to use VirtualBox.
Post Reply
mans
Posts: 12
Joined: 20. Oct 2012, 20:53

creating image from SD card and using it with VM

Post by mans »

I want to create an image from a SD card and using it inside a VM. Is it possible to do this?
I want somthing similar to the way that I can create an ISO image from a CD and then mount it on a VM.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: creating image from SD card and using it with VM

Post by BillG »

It is most unlikely that the vm will see an SD card in the host. A vm sees only its own emulated devices, not the physical devices in the physical machine. A vm can only use the physical devices in the host machine if the virtualization software (VirtualBox in this case) can pass data between the physical and virtual devices (as it does for the mouse and keyboard, for instance).
Bill
mans
Posts: 12
Joined: 20. Oct 2012, 20:53

Re: creating image from SD card and using it with VM

Post by mans »

Thanks for reply. So how can I use a SD card in VM?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: creating image from SD card and using it with VM

Post by mpack »

You can image an sd card in the same way you can image any other disk. Mention what the host OS is and we might even be able to recommend some tools to do it with.

Alternatively if you have a removable USB reader for the card then you shoud be able to mount it directly in the VM.
mans
Posts: 12
Joined: 20. Oct 2012, 20:53

Re: creating image from SD card and using it with VM

Post by mans »

I am using VM on a wondows 7 (x64) and I installed Linux on VM.
I am trying to follow this setup:
http://processors.wiki.ti.com/index.php ... VirtualBox
but i am not able to mount the sd card on linux.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: creating image from SD card and using it with VM

Post by mpack »

On a Windows host you should be able to create a virtual image of a disk using Disk2VHD, then mount the VHD in a VM.

For Linux host users: you would clone the disk using CloneZilla, then convert the resulting raw image drive to VDI format using CloneVDI with the "Compact" option enabled (using VBoxManage convertfromraw will also work, but result in a humungous VDI).
mans
Posts: 12
Joined: 20. Oct 2012, 20:53

Re: creating image from SD card and using it with VM

Post by mans »

Thanks.
This application can not see my SD card. The windows can see it since I can read and write to it, but Disk2VHD can not see it as an attached drive.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: creating image from SD card and using it with VM

Post by mpack »

mans wrote:Disk2VHD can not see it as an attached drive.
Well, that's a surprise: you are quite correct, though I can't think why Disk2VHD would have this limitation - I checked whether it simply disliked FAT formatted drives or sdcards, but no, it ignores NTFS formatted USB thumb drives too.

In that case, a less user friendly method which I've just confirmed does work is to use CloneVDI (see link in previous message) to clone a physical drive to a VDI (remember to tick the "Compact" box). The source filename field in CloneVDI must be "\\.\PhysicalDriveN", where N is a placeholder for the drive number (0,1,2 etc). You can get the drive number from My Computer | Manage | Disk Management. Although it works, CloneVDI is not really designed for cloning physical drives, a main symptom of which is that its default "destination" filename is all wrong, and the browse button beside it will not work. You must manually type in a correct filename (for the destination file) "blind" as it were.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: creating image from SD card and using it with VM

Post by scottgus1 »

Do you need to write to the disk image after making it? If not, try making a .iso out of the contents of the SD card, and mount the .iso like it's a CD. ImgBurn does this on Windows. See http://www.imgburn.com/index.php?act=download, mind which link you're clicking to download, there's a lot of ads on the site. I use ImgBurn, no problems.
mans
Posts: 12
Joined: 20. Oct 2012, 20:53

Re: creating image from SD card and using it with VM

Post by mans »

imgburn has the same limitation as disk2vhd as it can not see sd card and hence can not create iso from sd card.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: creating image from SD card and using it with VM

Post by mpack »

mans wrote:imgburn has the same limitation as disk2vhd as it can not see sd card and hence can not create iso from sd card.
I believe ScottGus intended that you would use ImgBurn to compile an ISO containing the normal contents (files and folders) from the sd card. He was not suggesting imaging a disk.
mans
Posts: 12
Joined: 20. Oct 2012, 20:53

Re: creating image from SD card and using it with VM

Post by mans »

Unfortunately I cannot do that as the SD card has a partition in Linux that cannot be read in Windows and hence I don't have access to its files.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: creating image from SD card and using it with VM

Post by mpack »

Then we are back to the CloneVDI suggestion I made in my last but one message.
Post Reply