1 .TH LOSETUP 8 "July 2003" "util-linux" "System Administration"
3 losetup \- set up and control loop devices
27 Delete all used loop devices:
33 Print name of first unused loop device:
53 .RB { \-f [ \-\-show ]| \fIloopdev\fP }
66 is used to associate loop devices with regular files or block devices,
67 to detach loop devices and to query the status of a loop device. If only the
68 \fIloopdev\fP argument is given, the status of the corresponding loop
72 The \fIsize\fR and \fIoffset\fR arguments may be followed by binary (2^N)
73 suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the
74 same meaning as "KiB") or decimal (10^N) suffixes KB, MB, GB, PB and EB.
76 .IP "\fB\-a, \-\-all\fP"
77 show status of all loop devices
78 .IP "\fB\-c, \-\-set-capacity\fP \fIloopdev\fP
79 force loop driver to reread size of the file associated with the specified loop device
80 .IP "\fB\-d, \-\-detach\fP \fIloopdev\fP..."
81 detach the file or device associated with the specified loop device(s)
82 .IP "\fB\-e, \-E, \-\-encryption \fIencryption_type\fP"
83 enable data encryption with specified name or number
84 .IP "\fB\-f, \-\-find\fP"
85 find the first unused loop device. If a
87 argument is present, use this device. Otherwise, print its name
88 .IP "\fB\-h, \-\-help\fP"
90 .IP "\fB\-j, \-\-associated \fIfile\fP"
91 show status of all loop devices associated with given
93 .IP "\fB\-o, \-\-offset \fIoffset\fP"
94 the data start is moved \fIoffset\fP bytes into the specified file or
96 .IP "\fB\-\-sizelimit \fIsize\fP"
97 the data end is set to no more than \fIsize\fP bytes after the data start
98 .IP "\fB\-p, \-\-pass-fd \fInum\fP"
99 read the passphrase from file descriptor with number
101 instead of from the terminal
102 .IP "\fB\-r, \-\-read-only\fP"
103 setup read-only loop device
105 print device name if the
109 argument are present.
110 .IP "\fB\-v, \-\-verbose\fP"
114 .B Cryptoloop is deprecated in favor of dm-crypt. For more details see
115 .B cryptsetup (8). It is possible that all bug reports regarding to -E/-e
116 .B options will be ignored.
119 It is possible to specify transfer functions (for encryption/decryption
120 or other purposes) using one of the
125 There are two mechanisms to specify the desired encryption: by number
126 and by name. If an encryption is specified by number then one
127 has to make sure that the Linux kernel knows about the encryption with that
128 number, probably by patching the kernel. Standard numbers that are
129 always present are 0 (no encryption) and 1 (XOR encryption).
130 When the cryptoloop module is loaded (or compiled in), it uses number 18.
131 This cryptoloop module will take the name of an arbitrary encryption type
132 and find the module that knows how to perform that encryption.
136 returns 0 on success, nonzero on failure. When
138 displays the status of a loop device, it returns 1 if the device
139 is not configured and 2 if an error occurred which prevented
140 from determining the status of the device.
151 The following commands can be used as an example of using the loop device.
154 # dd if=/dev/zero of=~/file.img bs=1MiB count=10
155 # losetup --find --show ~/file.img
157 # mkfs -t ext2 /dev/loop0
158 # mount /dev/loop0 /mnt
161 # losetup --detach /dev/loop0
164 Karel Zak <kzak@redhat.com>, based on original version from
165 Theodore Ts'o <tytso@athena.mit.edu>
167 The losetup command is part of the util-linux package and is available from
168 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.