Use o comando kpartx
para criar um dispositivo de loopback que possa ser formatado.
kpartx -a /path/to/imagefile.img # Presents partitions from the image file
mkfs.vfat /dev/mapper/loop0p1 # Format partition 1
mkfs.ext3 /dev/mapper/loop0p2 # Format partition 2
kpartx -d /path/to/imagefile.img # Unmaps the partitions from the image file