1LOSETUP(8)                   MAINTENANCE COMMANDS                   LOSETUP(8)
2
3
4

NAME

6       losetup - set up and control loop devices
7

SYNOPSIS

9       Get info:
10
11            losetup loop_device
12
13            losetup -a
14
15       Delete loop:
16
17            losetup -d loop_device
18
19       Print name of first unused loop device:
20
21            losetup -f
22
23       Setup loop device:
24
25            losetup [{-e|-E} encryption] [-o offset] [-p pfd] [-r]
26                    {-f|loop_device} file
27

DESCRIPTION

29       losetup  is  used to associate loop devices with regular files or block
30       devices, to detach loop devices and to  query  the  status  of  a  loop
31       device.  If  only  the loop_device argument is given, the status of the
32       corresponding loop device is shown.
33
34
35   Encryption
36       It is possible to specify transfer functions (for encryption/decryption
37       or  other  purposes) using one of the -E and -e options.  There are two
38       mechanisms to specify the desired encryption: by number and by name. If
39       an encryption is specified by number then one has to make sure that the
40       Linux kernel knows about the encryption with that number,  probably  by
41       patching the kernel. Standard numbers that are always present are 0 (no
42       encryption) and 1 (XOR encryption).   When  the  cryptoloop  module  is
43       loaded (or compiled in), it uses number 18.  This cryptoloop module wil
44       take the name of an arbitrary encryption type and finds the module that
45       knows  how to perform that encryption.  (Thus, either one uses a number
46       different from 18 with the -E option, or one uses a name  with  the  -e
47       option.)
48

OPTIONS

50       -a     Show status of all loop devices.
51
52       -d     Detach  the  file  or  device associated with the specified loop
53              device.
54
55       -E encryption_type
56              Enable data encryption with specified number.
57
58       -e encryption_name
59              Enable data encryption with specified name.
60
61       -f     Find the first  unused  loop  device.  If  a  file  argument  is
62              present, use this device. Otherwise, print its name.
63
64       -o offset
65              The  data start is moved offset bytes into the specified file or
66              device.
67
68       -p num Read the passphrase from file descriptor with number num instead
69              of from the terminal.
70
71       -r     Setup read-only loop device.
72

RETURN VALUE

74       losetup returns 0 on success, nonzero on failure. When losetup displays
75       the status of a loop device, it returns 1 if the device is not  config‐
76       ured  and 2 if an error occurred which prevented losetup from determin‐
77       ing the status of the device.
78
79

FILES

81       /dev/loop0, /dev/loop1, ...   loop devices (major=7)
82

EXAMPLE

84       If you are using the loadable module you must have  the  module  loaded
85       first with the command
86
87              # insmod loop.o
88
89       Maybe also encryption modules are needed.
90
91              # insmod des.o # insmod cryptoloop.o
92
93       The  following  commands  can  be  used as an example of using the loop
94       device.
95
96              # dd if=/dev/zero of=/file bs=1k count=100
97              # losetup -e des /dev/loop0 /file
98              Password:
99              Init (up to 16 hex digits):
100              # mkfs -t ext2 /dev/loop0 100
101              # mount -t ext2 /dev/loop0 /mnt
102               ...
103              # umount /dev/loop0
104              # losetup -d /dev/loop0
105
106       If you are using the loadable module you may remove the module with the
107       command
108
109              # rmmod loop
110

RESTRICTION

112       DES  encryption  is  painfully slow. On the other hand, XOR is terribly
113       weak.
114
115       Cryptoloop is deprecated and unmaintained in 2.6 kernels. Use dm-crypt.
116       For more details see cryptsetup(8).
117
118
119
120Linux                             2003-07-01                        LOSETUP(8)
Impressum