I found that recipe through googling a few months ago, don't really remember what it means, but I think the offset is to skip the MBR.
@addy86:
Have you tried Qemu? In my opinion it is a lot easier to use than bochs, and it is supposed to be faster as well, especially with the accelerator module.
http://fabrice.bellard.free.fr/qemu/
EDIT: This is useful to me too, so I wrote a bash script to mount a partition on a image, thanks for the tips about fdisk -u.
EDIT2: Bugfix for the below script, would fail for partitions marked bootable.
Code:
#!/bin/bash
die() {
echo "$1" >&2
exit 1
}
if [ "$UID" != 0 ]
then
die "You have to be root."
fi
if [ -z "$1" ]
then
echo \
"To list partitions on image:
$0 <hd image>
To mount partition on image:
$0 <hd image> <partition> <mountpoint>
To mount partition on image with a specific type:
$0 <hd image> <partition> <mountpoint> <filesystem>
Example:
$0 hd.img hd.img6 /mnt/tmp"
exit
fi
img="$1"
if [ "$#" == 1 ]
then
fdisk -l "$img"
elif [ "$#" == 3 ] || [ "$#" == 4 ]
then
part="$2"
mnt="$3"
begin="$(fdisk -lu "$img" 2>/dev/null | grep "$part" | \
(read a b c d; [ "$b" == "*" ] && echo "$c" || echo "$b"))"
if [ -z "$begin" ]
then
die "Error: Invalid partition given."
fi
if mount "$img" "$mnt" -o loop,offset="$((begin * 512))" -t "${4-auto}"
then
echo "Partition mounted"
fi
else
die "Error: Invalid number of arguments given"
fi