11

I just downloaded the Debian and Arch Linux files and I would like to mount before I burn into the SD card. How can I mount the img?

I tried to mount but I'm getting the following error:

sudo mount -o loop archlinuxarm-13-06-2012.img /mnt/
mount: you must specify the filesystem type

Is that yaffs2? How can I mount the yaffs2, as far as I know it's not supported yet under Ubuntu 12.04, and I couldn't find any package.

12

The Hard Way

Read my other answer on Is it possible to update, upgrade and install software before flashing an image?.

You need to calculate the offset of the filesystem you wish to mount.

The Easy, yet experimental way

Consider using my new utility piimg. Just build and run

$ sudo ./piimg mount archlinuxarm-13-06-2012.img /mnt

NOTE This hasn't been fully tested yet.

What does piimg do?

piimg performs a series of mounts by analysing the image and setting up the correct loop devices and mounts. It mounts / first, then /boot, binds/dev (recursively), binds /sys and creates /proc. You need to do the opposite to unmount, but there should be a umount subcommand soon.

DISCLAIMER I, Alex Chamberlain, am the lead developer of piimg. As such, I may be biased towards the use of piimg in relation to other methods.

  • @iungi Which method did you use? – Alex Chamberlain Jul 17 '12 at 8:29
  • Thank you for this valuable work. I just pointed out that it is necessary to install the package libparted0-dev to build correctly. I will use your utility and I'll point out potential problems. Just a little note: it seems more logical to install in /usr/local/sbin a program reserved for root ! Best regards. – user6426 Mar 11 '13 at 21:55
  • <br/> Another note, there is an oversight in your command line:<br/> $ sudo ./piimg mount sd.img /mnt – user6428 Mar 11 '13 at 22:25
  • @MarkBooth I haven't worked on piimg for a long time. I guess that the docs for that need updating, rather than this answer (given it doesn't tell you how to build it!) – Alex Chamberlain Mar 12 '13 at 11:15
  • @MarkBooth Oh there were 2. Yes, it needs updating. Done – Alex Chamberlain Mar 12 '13 at 11:15
1

The problem is that the image is a complete disk image including a partition table, not an image of an individual partition.

Theres a couple of ways round this, one way is to calculate an offset and use that for mounting (see alex's answer for more details).

Another way if you have a recent kernel and a recent version of losetup is to use the -P option to losetup e.g.

losetup -P -f <filename>

this will create a series of device nodes. The main /dev/loop<number> node and also nodes for each partition at /dev/loop<number>p<number> . You can then work with the device like any other paritioned device.

When you have finished you can remove the loopback device with

losetup -d /dev/loop<number>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.