Creating and writing to hd and fd images

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
newguy

Creating and writing to hd and fd images

Post by newguy »

Hi! Does anybody know how I can write and format a disk image created with the bochs disk image creation tool?
Schol-R-LEA

Re:Creating and writing to hd and fd images

Post by Schol-R-LEA »

That depends on what you mean to write to it, but assuming you mean to copy a boot image into the disk image's sector 0, any raw-writing utility should do the trick; some debuggers will do this as well. Under Windows, you can use the DOS DEBUG utility, or any of several tools such as RawWrite or partcopy; I find partcopy to be the most useful, but it's a matter of personal preference. Under Unix and Linux, you can use the dd(1) utility for this. See this thread for more details.
newguy

Re:Creating and writing to hd and fd images

Post by newguy »

But how do you write to a non-physical disk with debug? I know how to do it with real floppys, but with an image?
srg

Re:Creating and writing to hd and fd images

Post by srg »

I managed to use partcopy to take my test machine's 850MB hard disk and make an image file of it that just ran on bochs first time.

Very nice, although I had a bit of trouble getting the drive size perfectly correct. Win2k said that is was 815MB when it was 814MB (formatted capacity).

srg
Neuromancer

Re:Creating and writing to hd and fd images

Post by Neuromancer »

Do you mean a hard disk image?

Bochs needs to have a hard disk image which contains both MBR and the partitions.
You need to have 2 separated files, the MBR part and the partition.

First of all, create the disk image with bximage.
The fdisk it and set a partition, set the partition type flags and save it to the image.
Then you have to separate the MBR part and the partition. MBR is AFAIK 63 sectors long.
To separate them you can use "dd if=image.bin of=mbr.bin count=63" to create the MBR image and then "dd if=image.bin of=partition.bin skip=63" to create the partition.
Format the partition file with your file system tools (i.e. mke2fs partition.bin).
Now you can mount the partition.bin and copy the files on it.

You need to re-create the disk image to run it on bochs. Type "cat mbr.bin partition.bin > image.bin" et voil?, the image is ready.
newguy

Re:Creating and writing to hd and fd images

Post by newguy »

Thanks. But I am using windows xp, because linux doesn't support my wireless card(I have used linux, though, throug a lan-connection wih my notebook.)And, for the beginnig I want to edit a floppy-image.
Neuromancer

Re:Creating and writing to hd and fd images

Post by Neuromancer »

And, for the beginnig I want to edit a floppy-image.
;D Sorry.

I don't know how to do this on Window$. :-\
DennisCGc

Re:Creating and writing to hd and fd images

Post by DennisCGc »

MBR is AFAIK 63 sectors long.
Not entirely true, the MBR is 1 sector, but it's used to begin on the next track, so it's going to take (depending on your logical HD geo)64*63 = 4032 sectors :o .
And not 63 sectors ;) as you claim.
srg

Re:Creating and writing to hd and fd images

Post by srg »

Neur0m'ancer wrote: Do you mean a hard disk image?

Bochs needs to have a hard disk image which contains both MBR and the partitions.
You need to have 2 separated files, the MBR part and the partition.

First of all, create the disk image with bximage.
The fdisk it and set a partition, set the partition type flags and save it to the image.
Then you have to separate the MBR part and the partition. MBR is AFAIK 63 sectors long.
To separate them you can use "dd if=image.bin of=mbr.bin count=63" to create the MBR image and then "dd if=image.bin of=partition.bin skip=63" to create the partition.
Format the partition file with your file system tools (i.e. mke2fs partition.bin).
Now you can mount the partition.bin and copy the files on it.

You need to re-create the disk image to run it on bochs. Type "cat mbr.bin partition.bin > image.bin" et voil?, the image is ready.

Actually, the MBR is only 1 sector (512 bytes) is size. The rest of that region before the first partition wasn't used. Well, saying that, things like EZ-Drive or Ontrack Disk Manager, known as Dynamic Drive Overlay software and some viruses used it (a bit of a loophole!).

hope this helps!
srg
DennisCGc

Re:Creating and writing to hd and fd images

Post by DennisCGc »

newguy wrote: Thanks. But I am using windows xp, because linux doesn't support my wireless card(I have used linux, though, throug a lan-connection wih my notebook.)And, for the beginnig I want to edit a floppy-image.
Use Winimage :)
Just search on google and you'll find it ;D
newguy

Re:Creating and writing to hd and fd images

Post by newguy »

Thank you very much! WinImage is great! Thanks for posting y'all.
Post Reply