OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / util-linux / original / man8 / losetup.8
1 .TH LOSETUP 8 "2003-07-01" "Linux" "MAINTENANCE COMMANDS"
2 .SH NAME
3 losetup \- set up and control loop devices
4 .SH SYNOPSIS
5 .ad l
6 Get info:
7 .sp
8 .in +5
9 .B losetup
10 .I loop_device
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
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.
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.)
68 .SH OPTIONS
69 .IP \fB\-d\fP
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.
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.
79 .IP "\fB\-o \fIoffset\fP"
80 The data start is moved \fIoffset\fP bytes into the specified file or
81 device.
82 .IP "\fB\-p \fInum\fP"
83 Read the passphrase from file descriptor with number
84 .I num
85 instead of from the terminal.
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
95 .SH FILES
96 .nf
97 /dev/loop0, /dev/loop1, ...   loop devices (major=7)
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
105 Maybe also encryption modules are needed.
106 .IP
107 # insmod des.o
108 # insmod cryptoloop.o
109 .LP
110 The following commands can be used as an example of using the loop device.
111 .nf
112 .IP
113 # dd if=/dev/zero of=/file bs=1k count=100
114 # losetup -e des /dev/loop0 /file
115 Password:
116 Init (up to 16 hex digits):
117 # mkfs -t ext2 /dev/loop0 100
118 # mount -t ext2 /dev/loop0 /mnt
119  ...
120 # umount /dev/loop0
121 # losetup -d /dev/loop0
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.
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