Map a disk image file to the next free loop device.

Section: Mount and Unmount

Attach a loop device

bash
bash
sudo losetup -fP disk.img
Explanation

Map a disk image file to the next free loop device.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Mount and Unmount
List loop devices
Show loop device mappings.
OpenIn sheetbashsame section
Detach a loop device
Disconnect a loop device from its image file.
OpenIn sheetbashsame section
Mount an ISO image with loop
Loop-mount a disk image file.
OpenIn sheetbashsame section
Mount a device to a directory
Mount a block device using filesystem auto-detection.
OpenIn sheetbashsame section
Mount a filesystem read-only
Useful for safe inspection or recovery work.
OpenIn sheetbashsame section
Mount by UUID
Use a stable identifier instead of a device name.
OpenIn sheetbashsame section