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 the multiplicative
73 +suffixes KiB=1024, MiB=1024*1024, and so on for GiB, TiB, PiB, EiB, ZiB and YiB
74 +(the "iB" is optional, e.g. "K" has the same meaning as "KiB") or the suffixes
75 +KB=1000, MB=1000*1000, and so on for GB, PB, EB, ZB and YB.
77 .IP "\fB\-a, \-\-all\fP"
78 show status of all loop devices. Note that not all information are accessible
80 .IP "\fB\-c, \-\-set-capacity\fP \fIloopdev\fP
81 force loop driver to reread size of the file associated with the specified loop device
82 .IP "\fB\-d, \-\-detach\fP \fIloopdev\fP..."
83 detach the file or device associated with the specified loop device(s)
84 .IP "\fB\-D, \-\-detach-all\fP"
85 detach all associated loop devices
86 .IP "\fB\-e, \-E, \-\-encryption \fIencryption_type\fP"
87 enable data encryption with specified name or number
88 .IP "\fB\-f, \-\-find\fP"
89 find the first unused loop device. If a
91 argument is present, use this device. Otherwise, print its name
92 .IP "\fB\-h, \-\-help\fP"
94 .IP "\fB\-j, \-\-associated \fIfile\fP"
95 show status of all loop devices associated with given
97 .IP "\fB\-o, \-\-offset \fIoffset\fP"
98 the data start is moved \fIoffset\fP bytes into the specified file or
100 .IP "\fB\-\-sizelimit \fIsize\fP"
101 the data end is set to no more than \fIsize\fP bytes after the data start
102 .IP "\fB\-p, \-\-pass-fd \fInum\fP"
103 read the passphrase from file descriptor with number
105 instead of from the terminal
106 .IP "\fB\-P, \-\-partscan\fP"
107 force kernel to scan partition table on newly created loop device
108 .IP "\fB\-r, \-\-read-only\fP"
109 setup read-only loop device
111 print device name if the
115 argument are present.
116 .IP "\fB\-v, \-\-verbose\fP"
120 .B Cryptoloop is deprecated in favor of dm-crypt. For more details see
121 .B cryptsetup (8). It is possible that all bug reports regarding to -E/-e
122 .B options will be ignored.
125 It is possible to specify transfer functions (for encryption/decryption
126 or other purposes) using one of the
131 There are two mechanisms to specify the desired encryption: by number
132 and by name. If an encryption is specified by number then one
133 has to make sure that the Linux kernel knows about the encryption with that
134 number, probably by patching the kernel. Standard numbers that are
135 always present are 0 (no encryption) and 1 (XOR encryption).
136 When the cryptoloop module is loaded (or compiled in), it uses number 18.
137 This cryptoloop module will take the name of an arbitrary encryption type
138 and find the module that knows how to perform that encryption.
142 returns 0 on success, nonzero on failure. When
144 displays the status of a loop device, it returns 1 if the device
145 is not configured and 2 if an error occurred which prevented
146 from determining the status of the device.
157 The following commands can be used as an example of using the loop device.
160 # dd if=/dev/zero of=~/file.img bs=1MiB count=10
161 # losetup --find --show ~/file.img
163 # mkfs -t ext2 /dev/loop0
164 # mount /dev/loop0 /mnt
167 # losetup --detach /dev/loop0
170 Karel Zak <kzak@redhat.com>, based on original version from
171 Theodore Ts'o <tytso@athena.mit.edu>
173 The losetup command is part of the util-linux package and is available from
174 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.