Setup a Loop Device

losetup -Pf --show "${IMAGE_FILE}"
  • -P - read partition table
  • -f - use first available loop device
  • --show - report newly configured loop device

List

losetup -l

Teardown

losetup -d "${LOOP_DEVICE}"