How to create loop devices on Linux - Linux Tutorials - Learn Linux Configuration

A loop device is a pseudo-device which doesn’t correspond to a real, physical block device, but can be used to make a file appear and be treated like one. To manage loop devices on Linux, we can use the losetup command: the utility let us create new loop devices, detach them and retrieve information about existing ones.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-create-loop-devices-on-linux

I got an error after trying the losetup command

losetup: blockfile: failed to set up loop device: Inappropriate ioctl for device

Am I missing something? my system has no any loop device so I have created the /dev/loop0, and also tried with /dev/loop1