[Wylug-help] Disk Images and Partitions

Towle, William william.towle at echostar.com
Thu Jul 5 13:33:21 BST 2007


> > I might have dreamed this, but I've got a strong feeling that 
> > I've been
> > able to loopback mount the partitions in an image file, 
> > sometime in the
> > past.

>   You may indeed

  I've just tried; note in particular that the 'offset' argument
is in bytes (ie. you have to find the sectors-per-track value
used when you created the original image to use loopback mount
and multiply it by block size - 63*512=32256 in my case).

  Having done an fdisk on both the original hard disk image and
an msdosfs partition within it (via /dev/loop0), I find that a)
both times the sectors per track is correct, b) both warn "You
must set cylinders" and tell me how to, c) they differ on the
count of drive heads.
  Checking back in the original virtual machine, the number of
heads cited is correct, as is the cylinder count for the drive.
A quick scan of the fdisk source shows it having queried the
kernel to get this right; your problem may be simply that not
all software does this, and fdisk's "use the extra functions
menu" hint may well be the way to fix it).


Wills.

> 'mount' and/or 'losetup' are your friends. `man
> mount` covers the various options and caveats thus:
> 
> THE LOOP DEVICE
>        One further possible type is a mount via the loop 
> device. For example,
>        the command
> 
>          mount /tmp/fdimage /mnt -t msdos -o 
> loop=/dev/loop3,blocksize=1024
> 
>        will set up the loop device  /dev/loop3  to  
> correspond  to  the  file
>        /tmp/fdimage,  and then mount this device on /mnt.  
> This type of mount
>        knows about three options, namely loop, offset  and  
> encryption,  that
>                                                ^^^^^^
>        are  really options to losetup(8).  If no explicit 
> loop device is men-
>             ^^^^^^^^^^^^^^^^^^^^^^^^^
>        tioned (but just an option â-o loopâ is given), then 
> mount will try to
>        find  some  unused loop device and use that.  If you 
> are not so unwise
>        as to make /etc/mtab a symbolic link to  /proc/mounts  
> then  any  loop
>        device  allocated by mount will be freed by umount.  
> You can also free
>        a loop device by hand, using âlosetup -dâ, see losetup(8).
> 
> 
>   Wills.



More information about the Wylug-help mailing list