Mounting a HD image as a real drive in Windows

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Mounting a HD image as a real drive in Windows

Post by CodeCat »

I'm trying to figure out how to mount a Bochs HD image as a real drive in Windows. I've tried Filedisk, but when I mount the FreeDOS image on the Bochs site Windows just says the drive isn't formatted. After some messing around with the image, I discovered that apparently Filedisk deals only with images of a single partition, rather than entire drives like Bochs does. Does anyone know a way around this? (And yes, it has to be a hard drive image, can't be a floppy)
Kieran
Member
Member
Posts: 54
Joined: Mon Apr 11, 2005 11:00 pm

Re: Mounting a HD image as a real drive in Windows

Post by Kieran »

Well, try and use a USB pen drive, write the image using WinImage. Then you can boot FreeDOS from the USB device if your BIOS supports it.
Last edited by Kieran on Fri Oct 03, 2008 6:02 pm, edited 1 time in total.
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: Mounting a HD image as a real drive in Windows

Post by CodeCat »

Well, I'm using a GRUB boot floppy image as a boot loader, which should then load my kernel from the disc image and run it. That's the idea anyway, cause I didn't get that far yet because I'm trying to figure out how to get the kernel into the image to begin with (that's what I was hoping to use Filedisk for).
Kieran
Member
Member
Posts: 54
Joined: Mon Apr 11, 2005 11:00 pm

Re: Mounting a HD image as a real drive in Windows

Post by Kieran »

Ok, if you have a copy of Linux or a Linux Live CD you can put grub on the hard disk and move file to and fro whenever you require.
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: Mounting a HD image as a real drive in Windows

Post by CodeCat »

But that's not the problem, really. GRUB loads from the floppy image from within Bochs, and that works fine. I can tell it to run the kernel from the root directory of /dev/hda1, which would simply be a partition on another image file. The issue is here that I can't easily get my kernel into that image file with Filedisk. The only kind of images Bochs supports are images of complete drives (i.e. with an MBR, partition table and all), while Filedisk can only handle images of one partition (with no MBR, i.e. the first sector is the FAT bootsector). What I need to know is whether there is a way to somehow extract the partition from a Bochs-style image so that Filedisk can handle it. Then I could just mount that partition image with Filedisk, copy the kernel file into it with the basic Windows explorer, write the partition image back into the Bochs drive image, and then boot.

I could write a program to do that no problem, but I just wanted to know if there is an easier way to do it.
Kieran
Member
Member
Posts: 54
Joined: Mon Apr 11, 2005 11:00 pm

Re: Mounting a HD image as a real drive in Windows

Post by Kieran »

Have you tried WinImage?
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: Mounting a HD image as a real drive in Windows

Post by CodeCat »

Not yet, I'm kinda trying to avoid non-free software. But if it does the trick then I might use it.
Kieran
Member
Member
Posts: 54
Joined: Mon Apr 11, 2005 11:00 pm

Re: Mounting a HD image as a real drive in Windows

Post by Kieran »

OK, hope you find a solution or someone else can help.
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: Mounting a HD image as a real drive in Windows

Post by ru2aqare »

If you have Total Commander, you could use this plugin: here. It has both x86 and x64 drivers. Otherwise, FileDisk64 has worked for me. I haven't tried it though for Bochs images, and it has serious multi-user issues.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Mounting a HD image as a real drive in Windows

Post by Brynet-Inc »

People avoid research like the plague.. enough already. ;)

http://en.wikipedia.org/wiki/Loop_device
http://en.wikipedia.org/wiki/Disk_image_emulator
http://en.wikipedia.org/wiki/Category:D ... _emulators (Probably more relevant to your interests..).
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
clange
Member
Member
Posts: 163
Joined: Sun Oct 05, 2008 5:00 am
Location: Copenhagen, Denmark
Contact:

Re: Mounting a HD image as a real drive in Windows

Post by clange »

Hi

You could try VDK. http://chitchat.at.infoseek.co.jp/vmware/vdk.html. It handles VMware images and Bochs can use those too.

VMware image is a text file describing it and one or more data files. Example: test.vmdk (descr.) and test-s001.vmdk (data). When using VDK reference the description file and when using Bochs reference the data file. I don't think this will work with more than 1 data file though. I am doing it like this with 1 data file.

Hope it helps

Christian Lange
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: Mounting a HD image as a real drive in Windows

Post by CodeCat »

I decided to write my own utility to solve the problem anyway, as a matter of practice. I've attached it to the post. It's in source form only, but it uses nothing but standard C++ so compiling shouldn't be a problem. Hope it turns out to be useful for others as well. It certainly works for me.
Attachments
imgpart-1.0.zip
(16.56 KiB) Downloaded 75 times
Post Reply