mounting local file

Nils Kassube kassube at
Fri Jul 22 14:51:53 UTC 2011

Verde Denim wrote:
> I have a local file on my Ubu box that I made using dd from an SD
> Card. For whatever reason,
> mount -o loop <file-name> /mnt asks for the filesystem type, and
> regardless of the type I supply, mount tells me that it doesn't
> recognize the type. file <filename> tells me that this is an x86
> boot sector with an extended partition table, but does not reveal
> the filesystem type.
> am I hosed for being able to mount this file?

I suppose you made an image of the entire SD card. Then the problem is 
the partition table at the start of the image. Your mount command tries 
to mount that partition table which doesn't make sense (because it is 
not a file system). Instead try this command:

sudo mount -oloop,offset=32256 filename /mnt

Here I used the standard offset for a harddisk with 63 heads (also works 
for one of my CF cards) but your SD card might use a different 
configuration. Then you would need a different offset which depends on 
your SD card.

You could try the following loop to mount the first partition. It tries 
every offset in steps of 512 until a working partition is found. It will 
spit out lots of error messages for the bad offsets and finally print 
the working offset. Don't forget to replace the filename in the first 

OFS=512; until sudo mount -oloop,offset=$OFS filename /mnt; do
OFS=$(($OFS + 512)); done; echo $OFS

If there is no partition (or you used a wrong filename) it will not stop 
and you would have to use Ctrl-C to abort the loop.


More information about the ubuntu-users mailing list