Page 1 of 1

How to build a hard disk image in Linux?

Posted: Mon Sep 18, 2006 12:51 am
by icoming
I read the article "Disk Images under Linux", and followed the steps in this article to build a hard disk image. But it seems that I failed.
The only difference is that #cylinders I use is 40, and I attached the image file to /dev/loop1, but /dev/loop0.
But I don't think these differences will cause the error.
When I tried to install grub in this hard disk image, I got the following errors:
grub> device (hd0) /dev/loop1

grub> root (hd0)Unknown partition table signature
Filesystem type unknown, using whole disk

grub> setup (hd0)

Error 17: Cannot mount selected partition

So does anyone have some ideas?

Re:How to build a hard disk image in Linux?

Posted: Mon Sep 18, 2006 6:24 am
by Pype.Clicker
hm. the tutorial specially gives you a looppoint so that you can access the partition within the image. Most likely, GRUB want to operate on the whole disk (or maybe you should instruct it it's working on (hd0,0) rather than on (hd0)).

The simplest way to have this sorted out might be to "plug" the disk image in an emulator, run GRUB from a floppy image and let it install itself "within the bochs", then save your image for later uses.

Re:How to build a hard disk image in Linux?

Posted: Mon Sep 18, 2006 7:51 pm
by icoming
I tried to use this image in bochs.
The number of cylinders is 40, so in .bochsrc, the hard disk setting is as follow:
ata0-master: type=disk, path="/storage/soft/l4/fiaso/hd.img", mode=flat, cylinders=40, heads=16, spt=63
When I run bochs, I get the errors:
00000000000p[HD ] >>PANIC<< ata0-0: could not open hard drive image file '/storage/soft/l4/fiaso/hd.img'
00000000000p[HD ] >>PANIC<< ata0/0 image size doesn't match specified geometry

Re:How to build a hard disk image in Linux?

Posted: Tue Sep 19, 2006 2:34 am
by Pype.Clicker
probably you're better to create your initial file with bximage with the parameters you'd like, and then manipulate it as explained, then...