United States (change)
Shortcuts: Downloads Fedora Red Hat Network
Account Links: Cart Your Account Logout
A loopback device is used to access filesystems that are not associated with a block device (Hard Disk drives and CD-ROM drives are examples of block devices).
For example, an ISO image (Like the ones available for download from Red Hat Network (RHN) Easy ISO's section) is a file that contains a filesystem image. Linux uses the combination of a loopback device and a special device file to enable the filesystem image to be mounted and read as if it were a real disk or block device.
The rest of this article assumes that the system is using the 2.4 or 2.6 series kernels and that it has the loopback capability as a module. Standard Red Hat kernels have loopback support in the 'loop' module.
By default there are 7 devices available, named /dev/loop0 through to /dev/loop7 .
# ls -l /dev/loop* brw-r----- 1 root disk 7, 0 Jul 24 17:49 /dev/loop0 brw-r----- 1 root disk 7, 1 Jul 24 17:49 /dev/loop1 brw-r----- 1 root disk 7, 2 Jul 24 17:49 /dev/loop2 brw-r----- 1 root disk 7, 3 Jul 24 17:49 /dev/loop3 brw-r----- 1 root disk 7, 4 Jul 24 17:49 /dev/loop4 brw-r----- 1 root disk 7, 5 Jul 24 17:49 /dev/loop5 brw-r----- 1 root disk 7, 6 Jul 24 17:49 /dev/loop6 brw-r----- 1 root disk 7, 7 Jul 24 17:49 /dev/loop7
# mknod -m660 /dev/loop8 b 7 8
# ls -l /dev/loop8
brw-rw---- 1 root root 7, 8 Oct 3 14:54 /dev/loop8
# chown root.disk /dev/loop8
# ls -l /dev/loop8
brw-rw---- 1 root disk 7, 8 Oct 3 14:54 /dev/loop8
The loop module may be queried to see the options available:
# modinfo loop filename: /lib/modules/2.6.9-34.0.1.ELsmp/kernel/drivers/block/loop.ko parm: max_loop:Maximum number of loop devices (1-256) license: GPL alias: block-major-7-* vermagic: 2.6.9-34.0.1.ELsmp SMP 686 REGPARM 4KSTACKS gcc-3.4 depends:
To set the limit to 64 devices, edit the /etc/modules.conf file, adding an options line for the loop module:
# cat /etc/modules.conf
...
options loop max_loop=64
...
When the loop module is loaded or when the system is rebooted, the new setting will take effect.