]> git.ipfire.org Git - thirdparty/util-linux.git/blame - mount/losetup.8
Imported from util-linux-2.12j tarball.
[thirdparty/util-linux.git] / mount / losetup.8
CommitLineData
d03dd608 1.TH LOSETUP 8 "2003-07-01" "Linux" "MAINTENANCE COMMANDS"
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
fd6b7a7f 10.I loop_device
d162fcb5
KZ
11.sp
12.in -5
13Delete loop:
14.sp
15.in +5
16.B "losetup \-d"
17.I loop_device
18.sp
19.in -5
20Print name of first unused loop device:
21.sp
22.in +5
23.B "losetup \-f"
24.sp
25.in -5
26Setup loop device:
27.sp
28.in +5
29.B losetup
30.RB [{\-e | \-E}
31.IR encryption ]
32.RB [ \-o
33.IR offset ]
34.RB [ \-p
35.IR pfd ]
36.in +8
37.RB { \-f | \fIloop_device\fP }
38.I file
39.in -13
fd6b7a7f
KZ
40.ad b
41.SH DESCRIPTION
42.B losetup
43is used to associate loop devices with regular files or block devices,
44to detach loop devices and to query the status of a loop device. If only the
45\fIloop_device\fP argument is given, the status of the corresponding loop
46device is shown.
d03dd608
KZ
47
48.SS "Encryption"
49It is possible to specify transfer functions (for encryption/decryption
50or other purposes) using one of the
51.B \-E
52and
53.B \-e
54options.
55There are two mechanisms to specify the desired encryption: by number
56and by name. If an encryption is specified by number then one
57has to make sure that the Linux kernel knows about the encryption with that
58number, probably by patching the kernel. Standard numbers that are
59always present are 0 (no encryption) and 1 (XOR encryption).
60When the cryptoloop module is loaded (or compiled in), it uses number 18.
61This cryptoloop module wil take the name of an arbitrary encryption type
62and finds the module that knows how to perform that encryption.
63(Thus, either one uses a number different from 18 with the
64.B \-E
65option, or one uses a name with the
66.B \-e
67option.)
fd6b7a7f
KZ
68.SH OPTIONS
69.IP \fB\-d\fP
d03dd608
KZ
70Detach the file or device associated with the specified loop device.
71.IP "\fB\-E \fIencryption_type\fP"
72Enable data encryption with specified number.
73.IP "\fB\-e \fIencryption_name\fP"
74Enable data encryption with specified name.
d162fcb5
KZ
75.IP "\fB\-f\fP"
76Find the first unused loop device. If a
77.I file
78argument is present, use this device. Otherwise, print its name.
fd6b7a7f 79.IP "\fB\-o \fIoffset\fP"
d03dd608 80The data start is moved \fIoffset\fP bytes into the specified file or
fd6b7a7f 81device.
d03dd608
KZ
82.IP "\fB\-p \fInum\fP"
83Read the passphrase from file descriptor with number
84.I num
85instead of from the terminal.
66ee8158
KZ
86.SH RETURN VALUE
87.B losetup
88returns 0 on success, nonzero on failure. When
89.B losetup
90displays the status of a loop device, it returns 1 if the device
91is not configured and 2 if an error occurred which prevented
92.B losetup
93from determining the status of the device.
94
fd6b7a7f
KZ
95.SH FILES
96.nf
d03dd608 97/dev/loop0, /dev/loop1, ... loop devices (major=7)
fd6b7a7f
KZ
98.fi
99.SH EXAMPLE
100If you are using the loadable module you must have the module loaded
101first with the command
102.IP
103# insmod loop.o
104.LP
d03dd608
KZ
105Maybe also encryption modules are needed.
106.IP
107# insmod des.o
108# insmod cryptoloop.o
109.LP
fd6b7a7f
KZ
110The following commands can be used as an example of using the loop device.
111.nf
112.IP
d03dd608
KZ
113# dd if=/dev/zero of=/file bs=1k count=100
114# losetup -e des /dev/loop0 /file
fd6b7a7f
KZ
115Password:
116Init (up to 16 hex digits):
d03dd608
KZ
117# mkfs -t ext2 /dev/loop0 100
118# mount -t ext2 /dev/loop0 /mnt
fd6b7a7f 119 ...
d03dd608
KZ
120# umount /dev/loop0
121# losetup -d /dev/loop0
fd6b7a7f
KZ
122.fi
123.LP
124If you are using the loadable module you may remove the module with
125the command
126.IP
127# rmmod loop
128.LP
129.fi
130.SH RESTRICTION
131DES encryption is painfully slow. On the other hand, XOR is terribly weak.
d03dd608
KZ
132.\" .SH AUTHORS
133.\" .nf
134.\" Original version: Theodore Ts'o <tytso@athena.mit.edu>
135.\" Original DES by: Eric Young <eay@psych.psy.uq.oz.au>
136.\" .fi