LOSETUP(8) losetup - : losetup [options] -f|loopdev file : losetup [-l] [-a|loopdev] losetup -j [-o ] Recalibrate the size of a loop device: losetup -c - Detach loop devices: losetup -d - ... losetup -D Prevent loop devices from getting listed: losetup --remove loopdev ... losetup , . loopdev, . , . (., losetup -a) --list . It is possible to create multiple independent loop devices for the same backing file. This setup may be dangerous, can cause data loss, corruption, and overwrites. Use --nooverlap with --find during setup to avoid this problem. --find, losetup . 16. flock(1)* . KiB (=1024), MiB (=1024*1024), GiB, TiB, PiB, EiB, ZiB YiB (,,iB" , ., ,,K" ,,KiB") KB (=1000), MB (=1000*1000), GB, TB, PB, EB, ZB YB. -a, --all . . --list. ( --list) . -d, --detach -... . v3.7 ,, ". EBUSY , . , . , udevadm settle losetup. -D, --detach-all . -f, --find [] . , . , . --show -f . -L, --nooverlap . . --find. -j, --associated [-o ] . -o, --offset . ; . --loop-ref Set the reference string. The backwardly compatible default is to use the backing filename as a reference in the loop setup ioctl (aka lo_file_name). This option overrides this default behavior and sets the reference to the string. The reference may be used by udevd in /dev/loop/by-ref. The Linux kernel does not use the reference at all, but it could be used by some old utils that cannot read the backing file from sysfs. The reference is readable only for the root user (see --output +REF) and it is restricted to 64 bytes. --sizelimit . ; . -b, --sector-size ( 4.14). . -c, --set-capacity _ . -P, --partscan . . 512 , --sector-size --partscan. -r, --read-only . --direct-io[=on|off] / . off. --direct-io --direct-io=on . --direct-io=off . -l, --list -a, ; . --output, --noheadings, --raw, --json. -O, --output [,]... --list-. --help . --output-all . -n, --noheadings --list . --raw --list . -J, --json JSON --list . --remove loopdev... Remove the specified loop device(s). The loop device must be unused (not associated with any backing file). This option removes the device node from the system. In most cases, --detach is sufficient for normal use. See the LOOP DEVICE LIFECYCLE section below. -h, --help . -V, --version . LOOP DEVICE LIFECYCLE Loop devices go through several states during their lifecycle: Creation When losetup associates a loop device with a backing file, it automatically creates the device node (e.g., /dev/loop0) if it doesn't already exist. This happens on-demand when you use options like -f or specify a loop device explicitly. The device is created using the LOOP_CTL_ADD ioctl. Detachment The -d (--detach) option disassociates the backing file from the loop device using the LOOP_CLR_FD ioctl. After detachment, the loop device node remains in /dev and can be reused for another backing file. Use lsblk -a to see all loop device nodes, including unused ones. Removal The --remove option completely removes the loop device node from the system using the LOOP_CTL_REMOVE ioctl. The device must be detached first (not associated with any backing file). After removal, the device node disappears from /dev. ,,Cryptoloop" ,,dm-crypt"-. cryptsetup(8). losetup 0 , . losetup , 1 2 . Since version 2.37 losetup uses LOOP_CONFIGURE ioctl to set up a new loop device by one ioctl call. The old versions use LOOP_SET_FD and LOOP_SET_STATUS64 ioctls to do the same. LOOPDEV_DEBUG=all . LIBSMARTCOLS_DEBUG=all ,,libsmartcols" . LIBSMARTCOLS_DEBUG_PADDING=on . /dev/loop[0..N] /dev/loop-control . # dd if=/dev/zero of=~/file.img bs=1024k count=10 # losetup --find --show ~/file.img /dev/loop0 # mkfs -t ext2 /dev/loop0 # mount /dev/loop0 /mnt ... # umount /dev/loop0 # losetup --detach /dev/loop0 Karel Zak , Theodore Ts'o . , ,,https://github.com/util-linux/util-linux/issues[issue tracker]". losetup ,,util-linux" . util-linux 2.42.2 2026-06-16 LOSETUP(8)