]>
Commit | Line | Data |
---|---|---|
c372860d | 1 | .TH LOSETUP 8 "July 2014" "util-linux" "System Administration" |
fd6b7a7f KZ |
2 | .SH NAME |
3 | losetup \- set up and control loop devices | |
4 | .SH SYNOPSIS | |
5 | .ad l | |
d162fcb5 KZ |
6 | Get info: |
7 | .sp | |
8 | .in +5 | |
fd6b7a7f | 9 | .B losetup |
26ea6eb1 | 10 | .I loopdev |
d162fcb5 | 11 | .sp |
896352d3 OO |
12 | .B losetup -l |
13 | .RB [ \-a ] | |
8b125fae | 14 | .sp |
26ea6eb1 KZ |
15 | .B losetup -j |
16 | .I file | |
17 | .RB [ \-o | |
18 | .IR offset ] | |
259fcc57 | 19 | .sp |
d162fcb5 | 20 | .in -5 |
c372860d | 21 | Detach a loop device: |
d162fcb5 KZ |
22 | .sp |
23 | .in +5 | |
24 | .B "losetup \-d" | |
f7963004 | 25 | .IR loopdev ... |
d162fcb5 KZ |
26 | .sp |
27 | .in -5 | |
f1453d52 | 28 | Detach all associated loop devices: |
34f9b684 PU |
29 | .sp |
30 | .in +5 | |
31 | .B "losetup \-D" | |
32 | .sp | |
33 | .in -5 | |
c372860d | 34 | Print the name of the first unused loop device: |
d162fcb5 KZ |
35 | .sp |
36 | .in +5 | |
37 | .B "losetup \-f" | |
38 | .sp | |
39 | .in -5 | |
c372860d | 40 | Set up a loop device: |
d162fcb5 KZ |
41 | .sp |
42 | .in +5 | |
43 | .B losetup | |
d162fcb5 KZ |
44 | .RB [ \-o |
45 | .IR offset ] | |
7bcefc7f | 46 | .RB [ \-\-sizelimit |
ca1e1363 | 47 | .IR size ] |
26ea6eb1 | 48 | .in +8 |
c372860d BS |
49 | .RB [ \-Pr ] |
50 | .RB [ \-\-show ] " \-f" | \fIloopdev\fP | |
d162fcb5 | 51 | .I file |
d34ac93a | 52 | .sp |
d162fcb5 | 53 | .in -13 |
c372860d | 54 | Resize a loop device: |
d34ac93a KZ |
55 | .sp |
56 | .in +5 | |
57 | .B "losetup \-c" | |
58 | .I loopdev | |
59 | .in -5 | |
fd6b7a7f KZ |
60 | .ad b |
61 | .SH DESCRIPTION | |
62 | .B losetup | |
63 | is used to associate loop devices with regular files or block devices, | |
c372860d | 64 | to detach loop devices, and to query the status of a loop device. If only the |
26ea6eb1 | 65 | \fIloopdev\fP argument is given, the status of the corresponding loop |
c372860d BS |
66 | device is shown. If no option is given, all loop devices are shown. |
67 | .sp | |
68 | Note that the old output format (i.e. \fBlosetup -a\fR) with comma-delimited | |
69 | strings is deprecated in favour of the \fB--list\fR output format. | |
14576644 | 70 | |
fd6b7a7f | 71 | .SH OPTIONS |
c372860d BS |
72 | The \fIsize\fR and \fIoffset\fR |
73 | arguments may be followed by the multiplicative suffixes KiB (=1024), | |
74 | MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is | |
75 | optional, e.g., "K" has the same meaning as "KiB") or the suffixes | |
76 | KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. | |
ca1e1363 | 77 | |
c372860d BS |
78 | .TP |
79 | .BR \-a , " \-\-all" | |
80 | Show the status of all loop devices. Note that not all information is accessible | |
81 | for non-root users. See also \fB\-\-list\fR. The old output format (as printed | |
82 | without \fB--list)\fR is deprecated. | |
83 | .TP | |
84 | .BR \-c , " \-\-set-capacity " \fIloopdev | |
85 | Force the loop driver to reread the size of the file associated with the | |
86 | specified loop device. | |
87 | .TP | |
88 | .BR \-d , " \-\-detach " \fIloopdev\fR... | |
89 | Detach the file or device associated with the specified loop device(s). | |
90 | .TP | |
91 | .BR \-D , " \-\-detach-all" | |
92 | Detach all associated loop devices. | |
93 | .TP | |
94 | .BR \-f , " \-\-find" | |
95 | Find the first unused loop device. If a | |
d162fcb5 | 96 | .I file |
c372860d BS |
97 | argument is present, use the found device as loop device. |
98 | Otherwise, just print its name. | |
259fcc57 | 99 | .IP "\fB\-j, \-\-associated \fIfile\fP" |
c372860d BS |
100 | Show the status of all loop devices associated with the given |
101 | .IR file . | |
102 | .TP | |
103 | .BR \-l , " \-\-list" | |
104 | If a loop device or the \fB-a\fR option is specified, print the default columns | |
105 | for either the specified loop device or all loop devices; the default is to | |
106 | print info about all devices. See also \fB\-\-output\fP, \fB\-\-noheadings\fP | |
9f56106d | 107 | and \fB\-\-raw\fP. |
c372860d BS |
108 | .TP |
109 | .BR \-n , " \-\-noheadings" | |
110 | Don't print headings for \fB\-\-list\fP output format. | |
111 | .TP | |
112 | .BR \-o , " \-\-offset " \fIoffset | |
113 | The data start is moved \fIoffset\fP bytes into the specified file or device. | |
114 | .TP | |
115 | .BR \-O , " \-\-output " \fIcolumns | |
116 | Specify the columns that are to be printed for the \fB\-\-list\fP output. | |
117 | .TP | |
118 | .BR \-P , " \-\-partscan" | |
119 | Force the kernel to scan the partition table on a newly created loop device. | |
9f56106d | 120 | .IP "\fB\-\-raw\fP" |
c372860d BS |
121 | Use the raw \fB\-\-list\fP output format. |
122 | .TP | |
123 | .BR \-r , " \-\-read-only" | |
124 | Set up a read-only loop device. | |
125 | .IP "\fB\-\-sizelimit \fIsize\fP" | |
126 | The data end is set to no more than \fIsize\fP bytes after the data start. | |
4ac02d4d | 127 | .IP "\fB\-\-show\fP" |
c372860d BS |
128 | Display the name of the assigned loop device if the |
129 | .B \-f | |
ba3809b0 KZ |
130 | option and a |
131 | .I file | |
4ac02d4d | 132 | argument are present. |
c372860d BS |
133 | .TP |
134 | .BR \-v , " \-\-verbose" | |
135 | Verbose mode. | |
136 | .TP | |
137 | .BR \-V , " \-\-version" | |
138 | Display version information and exit. | |
139 | .TP | |
140 | .BR \-h , " \-\-help" | |
141 | Display help text and exit. | |
ba3809b0 | 142 | |
23b85230 | 143 | .SH ENCRYPTION |
c372860d BS |
144 | .B Cryptoloop is no longer supported in favor of dm-crypt. |
145 | .B For more details see cryptsetup (8). | |
23b85230 | 146 | |
66ee8158 KZ |
147 | .SH RETURN VALUE |
148 | .B losetup | |
c372860d | 149 | returns 0 on success, nonzero on failure. When |
66ee8158 KZ |
150 | .B losetup |
151 | displays the status of a loop device, it returns 1 if the device | |
152 | is not configured and 2 if an error occurred which prevented | |
c372860d | 153 | determining the status of the device. |
66ee8158 | 154 | |
fd6b7a7f | 155 | .SH FILES |
23b85230 KZ |
156 | .TP |
157 | .I /dev/loop[0..N] | |
158 | loop block devices | |
159 | .TP | |
0d0d12ad | 160 | .I /dev/loop-control |
23b85230 KZ |
161 | loop control device |
162 | ||
fd6b7a7f | 163 | .SH EXAMPLE |
fd6b7a7f KZ |
164 | The following commands can be used as an example of using the loop device. |
165 | .nf | |
166 | .IP | |
23b85230 KZ |
167 | # dd if=/dev/zero of=~/file.img bs=1MiB count=10 |
168 | # losetup --find --show ~/file.img | |
169 | /dev/loop0 | |
170 | # mkfs -t ext2 /dev/loop0 | |
171 | # mount /dev/loop0 /mnt | |
fd6b7a7f | 172 | ... |
d03dd608 | 173 | # umount /dev/loop0 |
23b85230 | 174 | # losetup --detach /dev/loop0 |
fd6b7a7f | 175 | .fi |
0bf03740 KZ |
176 | .SH ENVIRONMENT |
177 | .IP LOOPDEV_DEBUG=all | |
178 | enables debug output. | |
23b85230 | 179 | .SH AUTHORS |
c372860d | 180 | Karel Zak <kzak@redhat.com>, based on the original version from |
23b85230 | 181 | Theodore Ts'o <tytso@athena.mit.edu> |
86d62711 | 182 | .SH AVAILABILITY |
601d12fb KZ |
183 | The losetup command is part of the util-linux package and is available from |
184 | ftp://ftp.kernel.org/pub/linux/utils/util-linux/. |