summaryrefslogtreecommitdiffstats
path: root/Documentation/admin-guide/blockdev/loop.rst
blob: a11457479cb48b313a09fd30a4421fc3c7c76354 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Loopback Block Device
=====================

Overview
--------

The loopback device driver allows you to use a regular file as a block device.
You can then create a file system on that block device and mount it just as you
would mount other block devices such as hard drive partitions, CD-ROM drives or
floppy drives. The loop devices are block special device files with major
number 7 and typically called /dev/loop0, /dev/loop1 etc.

To use the loop device, you need the losetup utility, found in the `util-linux
package <https://www.kernel.org/pub/linux/utils/util-linux/>`_.

.. note::
	Note that this loop device has nothing to do with the loopback device \
	used for network connections from the machine to itself.


Parameters
----------

Kernel Command Line Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	max_loop
		The number of loop block devices that get unconditionally
		pre-created at init time. The default number is configured by
		BLK_DEV_LOOP_MIN_COUNT. Instead of statically allocating a
		predefined number, loop devices can be requested on-demand
		with the /dev/loop-control interface.


Module parameters
~~~~~~~~~~~~~~~~~

	max_part
		Maximum number of partitions per loop device (default: 0).

		If max_part is given, partition scanning is globally enabled
		for all loop devices.

	max_loop
		Maximum number of loop devices that should be initialized
		(default: 8). The default number is configured by
		BLK_DEV_LOOP_MIN_COUNT.


File format drivers
-------------------

The loopback device driver provides an interface for kernel modules to
implement custom file formats. By default, an initialized loop device uses the
**RAW** file format driver.

.. note::
	If you want to create and set up a new loop device with the losetup \
	utility make sure that the suitable file format driver is loaded \
	before.

The following file format drivers are available.


RAW
~~~

The RAW file format driver implements the binary reading and writing of a disk
image file. It supports discarding, asynchrounous IO, flushing and cryptoloop
support.

The driver's kernel module is named *loop_file_fmt_raw*.


QCOW
~~~~

The QCOW file format driver implements QEMU's copy on write file format in
version 2. At the moment, the file format driver only supports the reading
of QCOW2 disk image files. It does not support writing to QCOW2 images, the
recovery of broken QCOW images, snapshots and reference counts.

The driver's kernel module is named *loop_file_fmt_qcow*.