]>
Commit | Line | Data |
---|---|---|
d03dd608 | 1 | .TH LOSETUP 8 "2003-07-01" "Linux" "MAINTENANCE COMMANDS" |
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 |
fd6b7a7f | 10 | .I loop_device |
d162fcb5 KZ |
11 | .sp |
12 | .in -5 | |
13 | Delete loop: | |
14 | .sp | |
15 | .in +5 | |
16 | .B "losetup \-d" | |
17 | .I loop_device | |
18 | .sp | |
19 | .in -5 | |
20 | Print name of first unused loop device: | |
21 | .sp | |
22 | .in +5 | |
23 | .B "losetup \-f" | |
24 | .sp | |
25 | .in -5 | |
26 | Setup 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 | |
43 | is used to associate loop devices with regular files or block devices, | |
44 | to 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 | |
46 | device is shown. | |
d03dd608 KZ |
47 | |
48 | .SS "Encryption" | |
49 | It is possible to specify transfer functions (for encryption/decryption | |
50 | or other purposes) using one of the | |
51 | .B \-E | |
52 | and | |
53 | .B \-e | |
54 | options. | |
55 | There are two mechanisms to specify the desired encryption: by number | |
56 | and by name. If an encryption is specified by number then one | |
57 | has to make sure that the Linux kernel knows about the encryption with that | |
58 | number, probably by patching the kernel. Standard numbers that are | |
59 | always present are 0 (no encryption) and 1 (XOR encryption). | |
60 | When the cryptoloop module is loaded (or compiled in), it uses number 18. | |
61 | This cryptoloop module wil take the name of an arbitrary encryption type | |
62 | and 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 | |
65 | option, or one uses a name with the | |
66 | .B \-e | |
67 | option.) | |
fd6b7a7f KZ |
68 | .SH OPTIONS |
69 | .IP \fB\-d\fP | |
d03dd608 KZ |
70 | Detach the file or device associated with the specified loop device. |
71 | .IP "\fB\-E \fIencryption_type\fP" | |
72 | Enable data encryption with specified number. | |
73 | .IP "\fB\-e \fIencryption_name\fP" | |
74 | Enable data encryption with specified name. | |
d162fcb5 KZ |
75 | .IP "\fB\-f\fP" |
76 | Find the first unused loop device. If a | |
77 | .I file | |
78 | argument is present, use this device. Otherwise, print its name. | |
fd6b7a7f | 79 | .IP "\fB\-o \fIoffset\fP" |
d03dd608 | 80 | The data start is moved \fIoffset\fP bytes into the specified file or |
fd6b7a7f | 81 | device. |
d03dd608 KZ |
82 | .IP "\fB\-p \fInum\fP" |
83 | Read the passphrase from file descriptor with number | |
84 | .I num | |
85 | instead of from the terminal. | |
66ee8158 KZ |
86 | .SH RETURN VALUE |
87 | .B losetup | |
88 | returns 0 on success, nonzero on failure. When | |
89 | .B losetup | |
90 | displays the status of a loop device, it returns 1 if the device | |
91 | is not configured and 2 if an error occurred which prevented | |
92 | .B losetup | |
93 | from 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 | |
100 | If you are using the loadable module you must have the module loaded | |
101 | first with the command | |
102 | .IP | |
103 | # insmod loop.o | |
104 | .LP | |
d03dd608 KZ |
105 | Maybe also encryption modules are needed. |
106 | .IP | |
107 | # insmod des.o | |
108 | # insmod cryptoloop.o | |
109 | .LP | |
fd6b7a7f KZ |
110 | The 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 |
115 | Password: |
116 | Init (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 | |
124 | If you are using the loadable module you may remove the module with | |
125 | the command | |
126 | .IP | |
127 | # rmmod loop | |
128 | .LP | |
129 | .fi | |
130 | .SH RESTRICTION | |
131 | DES 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 |