# bytes per sector
bytes=512
# sectors per track
sectors=63
# heads per track
heads=16
# bytes per cylinder is bytes*sectors*head
bpc=$(( bytes*sectors*heads ))
# number of cylinders
# A image of $size MB
size=5
cylinders=$(( ($size*1024*1024) / $bpc ))

# Path to disk image
image="/opt/writeos/hd.img"
# Path to location to mount image
mount="/mnt/os"

# Suppose you chose the default value for the start of the partition, i.e. Cylinder 1
# MBR resides in sector 0, this leaves sectors 1 through 62 unused.
start=63
offset=$(( start*bytes ))

mount -oloop=/dev/loop0,offset=$offset $image $mount

