Add support for "raw images"

Here you can provide suggestions on how to improve the product, website, etc.
Post Reply
pthfdr
Posts: 15
Joined: 6. Oct 2015, 12:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: FreeDOS,NetBSD,Windoze ExPee,Windoze X

Add support for "raw images"

Post by pthfdr »

It seems that VirtualBox does not support "raw file" as a HDD image.
Some people create new images by generating a file using dd,fdisk that file,and create filesystems within the file.
I think it has some points because:
1.It is easier to mount such file on a real computer than VDI images
2.Some rare filesystems or parameters cannot be done within the guest OS
(for example I could create an FAT32 with just 1 FAT and 2 reserved sector,set media byte to 0xFC,and change the boot message,which cannot be achieved on DOS)
3.Some forums only provide such images (raw disk dump) since they don't know what kind of emulator the downloaders are using
It seems that VirtualBox is somewhat "picky" on file extensions,and such files do not match any kind of types(VDI,VMDK,VHD,HDD,QED,QCOW).
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Add support for "raw images"

Post by loukingjr »

Three comments…
1. VirtualBox is not an emulator.
2. The logic of calling a program "picky" because it may not do something you wish it did escapes me.
3. VirtualBox is not an emulator.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
pthfdr
Posts: 15
Joined: 6. Oct 2015, 12:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: FreeDOS,NetBSD,Windoze ExPee,Windoze X

Re: Add support for "raw images"

Post by pthfdr »

I don't mean it is an emulator.
I have said that sometimes users need to start VMs using "pre-build" hard disk images with custom partition/filesystem layout.
That include things like custom bootloaders and other things which is hard to produce in the "default settings" of target guest systems and has to be modified externally.
At the very least,there should be a tool to convert between raw disk images and VDIs.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Add support for "raw images"

Post by loukingjr »

pthfdr wrote:3.Some forums only provide such images (raw disk dump) since they don't know what kind of emulator the downloaders are using
my mistake.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Add support for "raw images"

Post by loukingjr »

OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Add support for "raw images"

Post by michaln »

pthfdr wrote:It seems that VirtualBox does not support "raw file" as a HDD image.
Yes and no. No, you can't attach a raw image directly because it's unsuitable for general use. There's nowhere to put metadata information like UUIDs, snapshot chains, or, perhaps most importantly, geometry information. Yes, you can create a "flat" VMDK descriptor which is a small text file referencing the raw image. VirtualBox is happy to use that.
pthfdr
Posts: 15
Joined: 6. Oct 2015, 12:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: FreeDOS,NetBSD,Windoze ExPee,Windoze X

Re: Add support for "raw images"

Post by pthfdr »

But what about those DSK "floppys" and ISO "opticals"?
They are raw images without such information,and VB can directly recorgnize them.
Why not hard disks?
I know this feature request is not practical for most of people,
But there's always someone who has hex editors/patchers installed and wants to experiment with things.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Add support for "raw images"

Post by michaln »

pthfdr wrote:But what about those DSK "floppys" and ISO "opticals"?
They are raw images without such information,and VB can directly recorgnize them.
Why not hard disks?
ISO images are read-only media with no geometry and thus no problems. Floppy images do have a geometry but that is determined based on the file size. Basically it's possible to tell what kind of floppy it is by looking at the file size alone. If it's 720K, you know it's 80 tracks, two sides and 9 sectors per track.

For hard disks, that just doesn't work. If I have a raw image that's 2GB in size, it can have multiple valid geometries. If the geometry is reported wrong, the data will be at best inaccessible and at worst damaged.
I know this feature request is not practical for most of people,
But there's always someone who has hex editors/patchers installed and wants to experiment with things.
See previous reply -- with a flat VMDK descriptor you get 99.99% of what you want. Raw format is indeed impractical for most users and that's why VirtualBox/VMware/VirtualPC does not directly support it.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Add support for "raw images"

Post by mpack »

@pthfdr: What's the big deal? Just create a VMDK descriptor for it and you're done. Here's one you can modify :-

Code: Select all

# Disk DescriptorFile
version=1
CID=ad885fa2
parentCID=ffffffff
createType="monolithicFlat"

# Extent description
# MAKE SURE SIZE(IN SECTORS) AND PATH IS CORRECT
RW 12345678 FLAT "path to file goes here" 0

# The Disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.geometry.cylinders = "16383"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"
ddb.toolsVersion = "7240"
ddb.geometry.biosCylinders="1024"
ddb.geometry.biosHeads="255"
ddb.geometry.biosSectors="63"
You can also convert the raw file to VDI using CloneVDI. CloneVDI requires raw images to have a ".raw" extension.
pthfdr
Posts: 15
Joined: 6. Oct 2015, 12:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: FreeDOS,NetBSD,Windoze ExPee,Windoze X

Re: Add support for "raw images"

Post by pthfdr »

Thanks.
Problem solved.
Post Reply