Getting at the EXT partition in a Raspberry Pi OS image
Mounting an image with multiple partitions is somewhat disinginuous on Linux by default, but you can make things much easier in one of two ways. The following worked for me in Debian Squeeze on the Pi. You can either:
modprobe loop max_part=63
Or, if loop is compiled into your kernel, you will need to add loop.max_part=63 to your config.txt on Pi, or your kernel options on a desktop/laptop.
This makes loop mounting disks with multiple partitions a breeze, the partitions will show up as /dev/loopXp0, /dev/loopXp1 and so on. To mount an image to loop you should:
losetup /dev/loop0 your-os-image.img
mount /dev/loop0p2 /mnt
In this example, /dev/loop0p2 should be the linux partition of your Raspberry Pi image. You can now rsync this to an external hard drive, or extract data if it's a backup.
If all else fails you can use kpartx, which makes it much simpler to mount disk images:
apt-get install kpartx
kpartx -v -a your-os-image.img
You can then mount the freshly setup loop devices as normal. See this guide on mounting disk images for more information.
« Back to index Posted on 2012-07-18 by Philip Howard