]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/losetup.8
build-sys: release++ (v2.24-rc1)
[thirdparty/util-linux.git] / sys-utils / losetup.8
CommitLineData
232dc924 1.TH LOSETUP 8 "July 2003" "util-linux" "System Administration"
fd6b7a7f
KZ
2.SH NAME
3losetup \- set up and control loop devices
4.SH SYNOPSIS
5.ad l
d162fcb5
KZ
6Get 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
KZ
20.in -5
21Delete loop:
22.sp
23.in +5
24.B "losetup \-d"
f7963004 25.IR loopdev ...
d162fcb5
KZ
26.sp
27.in -5
34f9b684
PU
28Delete all used loop devices:
29.sp
30.in +5
31.B "losetup \-D"
32.sp
33.in -5
d162fcb5
KZ
34Print name of first unused loop device:
35.sp
36.in +5
37.B "losetup \-f"
38.sp
39.in -5
40Setup loop device:
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
d162fcb5
KZ
49.RB [ \-p
50.IR pfd ]
916bf85e 51.RB [ \-rP ]
f7963004 52.RB { \-f [ \-\-show ]| \fIloopdev\fP }
d162fcb5 53.I file
d34ac93a 54.sp
d162fcb5 55.in -13
d34ac93a
KZ
56Resize loop device:
57.sp
58.in +5
59.B "losetup \-c"
60.I loopdev
61.in -5
fd6b7a7f
KZ
62.ad b
63.SH DESCRIPTION
64.B losetup
65is used to associate loop devices with regular files or block devices,
66to detach loop devices and to query the status of a loop device. If only the
26ea6eb1 67\fIloopdev\fP argument is given, the status of the corresponding loop
fd6b7a7f 68device is shown.
d03dd608 69
ead259e3
KZ
70Note that the old output format (e.g. losetup -a) with comma delimited strings is
71deprecated in favour of the --list output format (e.g. losetup -a -l).
fd6b7a7f 72.SH OPTIONS
d636d6d8
BV
73+The \fIsize\fR and \fIoffset\fR arguments may be followed by the multiplicative
74+suffixes KiB=1024, MiB=1024*1024, and so on for GiB, TiB, PiB, EiB, ZiB and YiB
75+(the "iB" is optional, e.g. "K" has the same meaning as "KiB") or the suffixes
16ef36f7 76+KB=1000, MB=1000*1000, and so on for GB, TB, PB, EB, ZB and YB.
ca1e1363 77
d99f0140 78.IP "\fB\-a, \-\-all\fP"
6af8d3d7 79show status of all loop devices. Note that not all information are accessible
ead259e3
KZ
80for non-root users. See also \fB\-\-list\fP. The old output format (as printed
81without --list) is deprecated.
d34ac93a
KZ
82.IP "\fB\-c, \-\-set-capacity\fP \fIloopdev\fP
83force loop driver to reread size of the file associated with the specified loop device
f7963004 84.IP "\fB\-d, \-\-detach\fP \fIloopdev\fP..."
27d320d6 85detach the file or device associated with the specified loop device(s)
26c15246
PU
86.IP "\fB\-D, \-\-detach-all\fP"
87detach all associated loop devices
d99f0140
KZ
88.IP "\fB\-f, \-\-find\fP"
89find the first unused loop device. If a
d162fcb5 90.I file
259fcc57 91argument is present, use this device. Otherwise, print its name
d99f0140
KZ
92.IP "\fB\-h, \-\-help\fP"
93print help
259fcc57
KZ
94.IP "\fB\-j, \-\-associated \fIfile\fP"
95show status of all loop devices associated with given
96.I file
896352d3 97.IP "\fB\-l, \-\-list"
9f56106d
KZ
98if a loop device or the -a option is specified, print default columns for
99either the specified loop device or all loop devices, default is to print info
100about all devices. See also \fB\-\-output\fP, \fB\-\-noheadings\fP
101and \fB\-\-raw\fP.
102.IP "\fB\-n, \fB\-\-noheadings\fP"
103don't print headings for \fB\-\-list\fP output format
d99f0140 104.IP "\fB\-o, \-\-offset \fIoffset\fP"
259fcc57
KZ
105the data start is moved \fIoffset\fP bytes into the specified file or
106device
896352d3
OO
107.IP "\fB\-O, \-\-output \fIcolumns\fP"
108specify which columns are to be printed for the \fB\-\-list\fP output
ca1e1363
KZ
109.IP "\fB\-\-sizelimit \fIsize\fP"
110the data end is set to no more than \fIsize\fP bytes after the data start
916bf85e
KZ
111.IP "\fB\-P, \-\-partscan\fP"
112force kernel to scan partition table on newly created loop device
9f56106d
KZ
113.IP "\fB\-\-raw\fP"
114use raw \fB\-\-list\fP output format
d99f0140
KZ
115.IP "\fB\-r, \-\-read-only\fP"
116setup read-only loop device
4ac02d4d 117.IP "\fB\-\-show\fP"
d99f0140 118print device name if the
ba3809b0
KZ
119.I -f
120option and a
121.I file
4ac02d4d 122argument are present.
d99f0140
KZ
123.IP "\fB\-v, \-\-verbose\fP"
124verbose mode
ba3809b0 125
23b85230 126.SH ENCRYPTION
5cf05c71 127.B Cryptoloop is no longer supported in favor of dm-crypt. For more details see
8323d9fd 128.B cryptsetup(8).
23b85230 129
66ee8158
KZ
130.SH RETURN VALUE
131.B losetup
132returns 0 on success, nonzero on failure. When
133.B losetup
134displays the status of a loop device, it returns 1 if the device
135is not configured and 2 if an error occurred which prevented
66ee8158
KZ
136from determining the status of the device.
137
fd6b7a7f 138.SH FILES
23b85230
KZ
139.TP
140.I /dev/loop[0..N]
141loop block devices
142.TP
143.I /dev/loop-cotrol
144loop control device
145
fd6b7a7f 146.SH EXAMPLE
fd6b7a7f
KZ
147The following commands can be used as an example of using the loop device.
148.nf
149.IP
23b85230
KZ
150# dd if=/dev/zero of=~/file.img bs=1MiB count=10
151# losetup --find --show ~/file.img
152/dev/loop0
153# mkfs -t ext2 /dev/loop0
154# mount /dev/loop0 /mnt
fd6b7a7f 155 ...
d03dd608 156# umount /dev/loop0
23b85230 157# losetup --detach /dev/loop0
fd6b7a7f 158.fi
23b85230
KZ
159.SH AUTHORS
160Karel Zak <kzak@redhat.com>, based on original version from
161Theodore Ts'o <tytso@athena.mit.edu>
86d62711 162.SH AVAILABILITY
601d12fb
KZ
163The losetup command is part of the util-linux package and is available from
164ftp://ftp.kernel.org/pub/linux/utils/util-linux/.