-
Notifications
You must be signed in to change notification settings - Fork 41
Loop mounting a Raspberry Pi image file under Linux
Michael Stegeman edited this page Apr 11, 2018
·
1 revision
Loop mounting allows you to mount an image file on a Linux host.
sudo apt install kpartx
sudo umount /dev/sdf1
sudo umount /dev/sdf2
sudo dd status=progress if=/dev/sdf of=2017-04-10-gateway-build.img
In the tools directory you'll find a couple of helper scripts which automate the process of setting up the loop mounts and mounting/unmounting. mount-img.sh will create the loop mounts and mount the root partition. umount-img.sh undoes the work done by mount-img.sh.
sudo kpartx -v -a 2017-04-10-gateway-build.img
/dev/mapper/loop0p1
will correspond to the boot partition, and /dev/mapper/loop0p2
will correspond to the root partition.
sudo mkdir -p rpi-root
sudo mount /dev/mapper/loop0p1 rpi-root
sudo umount rpi-root
kpartx -v -d 2017-04-10-gateway-build.img