Skip to content

Mount a Bochs disk image

We can mount a bochs disk image from Linx with the following command:

sudo mount -t msdos -o loop,offset=32256 disk.img /mnt/bochs/

The offset of 32256 is correct if the image was created with the Bochs Disk Image Creator, but how can the offset be calculated?

sudo fdisk -l -u disk.img

Disk disk.img: 99.9 MiB, 104767488 bytes, 204624 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device    Boot Start    End Sectors  Size Id Type
disk.img1 *       63 204623  204561 99.9M  6 FAT16

This shows us that the partition starts at the 63rd block. Each sector is 512 bytes, giving an offset of 512 * 63 or 32256 bytes.

More information

http://bochs.sourceforge.net/doc/docbook/user/loop-device-usage.html

https://www.redhat.com/archives/bochs-developers/1999-February/msg00018.html

http://www.julienlecomte.net/blog/2007/07/3/index.html

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options