Why does Virtual Box care if the image file is "valid"?

0

I dd'ed an entire Linux hard-drive with several partitions to a single raw disk image. I've given up on loop-mounting the file on OS X, so I've installed Debian on a VirtualBox on my Macbook, hoping to mount the image there. However, I'm experiencing a problem in VirtualBox trying to add the disk image to any of the floppy, IDE, or SATA controllers before booting the machine. It gives me this:

Failed to open the floppy disk file 
/path/to/clone.img.

Could not get the storage format of the medium 
'/path/to/clone.img' 
(VERR_NOT_SUPPORTED).

My question is: why does VirtualBox care? On a real computer, I can insert a disk containing complete nonsense in a drive and it doesn't spit the disk out and yell at me; the firmware or operating system does that.

If I tell VirtualBox "this is an ISO", shouldn't it say "If you say so..." and feed the image file's raw information to the virtual machine, regardless of what's in the file?

Sorry if this is a noob question, I'm still new to VMs, and VirtualBox especially. Thanks in advance.

Edit:

I did figure out how to mount the drive, but I still want to know why VirtualBox cares whether the .img file is valid.

Edit 2:

I was able to add the file by renaming it to "clone.iso" and adding it as a CD/DVD to the IDE controller.

James M. Lay

Posted 2015-10-03T21:03:06.690

Reputation: 145

You probably need to tell it that this is a raw file, not one of the other image files that virtual box supports (these include compress disks, that v-box would need to interpret). – ctrl-alt-delor – 2015-10-03T21:12:34.727

>

  • If you have the solution, then you should give that "detail" to help potential answerers target their question.
  • The error message seems to indicate that you did not specify (it "could not get") the storage format of the medium. Try specifying (or converting) it - which is likely what you did.
  • < – Dirk – 2015-10-03T21:13:48.580

    @richard: I'll add for clarification. I figured that it would be implicit that it was a raw because I used dd to copy an entire hard drive. – James M. Lay – 2015-10-03T21:21:02.293

    @richard, actually it already does say 'raw disk image' in the first sentence. I know people tend to gloss over the first paragraph though. – James M. Lay – 2015-10-03T21:22:30.397

    @Dirk: Good suggestion. I added my fix; however, the question still stands. – James M. Lay – 2015-10-03T21:25:22.753

    You said that the image is a raw image, you did not tell us that you told virtual-box this. Sorry for the miss-understanding. – ctrl-alt-delor – 2015-10-03T21:33:46.007

    What you describe looks strange, but I am afraid without the file at hand, nobody will be able to give more explanations. And frankly, you do not need a solution, you have it. Should your question be rephrased? (Why a raw image cannot be connected as HDD, but only as ISO image?) It may be a bug with a specific VB version, which you would be better off to file with Oracle support. Or do you really want to know why VB makes wich checks on mounted disk images? (I have some guesses on that, too. But I am sure you do as well.) – Dirk – 2015-11-11T10:03:47.847

    Proposal: remove Edit+Edit2. Rephrase whole question instead. Think about a new visitor to this question, supposedly able to input some new idea with a fresh view. (Edit history is kept for reference, if ever needed.) – Dirk – 2015-11-11T10:05:36.857

    Answers

    1

    VirtualBox does not support raw disk images. However, you can use the convertfromraw operation to convert the image:

    VBoxManage convertfromraw   <filename> <outputfile>
                                [--format VDI|VMDK|VHD]
                                [--variant Standard,Fixed,Split2G,Stream,ESX]
                                [--uuid <uuid>]
    

    Meaning, for example:

    VBoxManage convertfromraw my_image.img my_image.vdi
    

    Please note that you need enough disk space for both the raw and the VDI image.

    Daniel B

    Posted 2015-10-03T21:03:06.690

    Reputation: 40 502

    It does say in that link you posted that the virtual media manager supports "floppy images in RAW format"... which is precisely what I was trying to do. Any clue why it would try to verify a raw file? Does it need meta-information? – James M. Lay – 2015-10-03T23:10:14.507

    No, it's not. It's not a floppy image and it's not a CD image either. – Daniel B – 2015-10-04T00:35:16.957