I'm trying to make a .img from a tarball using the following script I found:#!/bin/bash# Packages required# dosfstools parted # Can be run on any Linux system# loop.max_part=15 must be in kernel cmdline (cmdline.txt for rpi)# then rebootecho creating image to fit on 2Gb carddd if=/dev/zero of=arch-rpi.img bs=1M count=1850echo Partitioningfdisk arch-rpi.img <<EOFonp1+100Mtcnp2wEOFsleep 5losetup -f arch-rpi.imgsleep 5echo Formatting vfatmkfs.vfat /dev/loop0p1sleep 5mkdir bootecho Mounting bootmount /dev/loop0p1 bootecho Installingecho Formatting ext4mkfs.ext4 /dev/loop0p2sleep 5mkdir rootecho Mounting rootmount /dev/loop0p2 rootwget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gzecho Installingbsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C rootsyncmv root/boot/* bootsyncumount boot rootlosetup -d /dev/loop0p1losetup -d /dev/loop0p1losetup -d /dev/loop0echo All complete, image arch-rpi.img created, compressing....zip -9 arch-rpi.img.zip arch-rpi.imgI'm doing this on my Raspberry Pi - Raspbian Wheezy. And when it gets to the line mkfs.vfat /dev/loop0p1 It says there's no such file / directory. I've read enough on Linux to know I'm trying to mount the .img as a loop device and then use mkfs to prepare the image for the tarball, but I don't quite know why loop0p# files are not there, they are listed by fdisk -l. What do I need to to in order to get this script I found working? 
Generating a .img from tarball: The /dev/loop devices
loop device;disk image