Loop device

A loop device is generally a device that points back to itself.

  • In the network technology, a network interface that directly returns all over it shipped packages again as received packets to the network stack of the system, without transferring over physical network connections. In the IPv4 addresses are reserved for loopback interfaces in the network 127.0.0.0 / 8. For more information, see article loopback.
  • Linux is a block device that corresponds to a physical device, but as the underlying storage uses a file. Since the kernel only mount file systems ( mount ) can be located on block devices, loop devices are generally used to include files as this file system images.

Examples

The mount a disk image in the file tree requires basically two steps:

These two steps can be done either separately or be performed by specifying the appropriate options with a single invocation of the utility mount together. The first step and the command losetup on Linux or lofiadm run under SunOS. If beispiel.img is a normal file that contains an image with a file system, and / mnt / directory is a directory on a Linux computer, the system administrator (super user) can perform the following commands:

Losetup / dev/loop0 beispiel.img mount / dev/loop0 / mnt / directory The first command associates the loop device node / dev/loop0 beispiel.img with the normal file. The second command depends on this pseudo device at the location / mnt / directory in the file tree one, as if / dev/loop0 a normal hard disk or a disk section ( partition).

The Dienstprogrammm mount is able to perform the entire procedure in a single step:

Mount-o loop beispiel.img / mnt / directory The photographs may be the device in both cases the command

Umount / mnt / directory applications

This method is useful wherever real hard drives, CD or DVD drives to be simulated, because the use of real physically existing equipment too expensive, too cumbersome, too slow, or otherwise does not make sense.

An example:

The additional utility partimage produces compressed images of hard disk partitions for backup complete operating system installations. If individual files are to be released from such an image out later without a complete computer is to restore the image is available, such an image can be stored in a device created by the loop pseudo - disk area.

Extensions

About loop devices it is possible to encrypt disk ( cryptoloop ). The algorithms were originally used XOR ( very uncertain) and DES (very slow and also unsafe ). The generation of sub- keys for each disk blocks is susceptible to watermark attacks. Cryptoloop however, is not developed any further. There is dm-crypt with a safe alternative that can, however, not create a block device to a file (but can access one or more loop devices).

For operating system live CDs and the like (eg Knoppix) exists an extension called cloop, containing a specially compressed image of the block devices.

Other operating systems

For Windows, the open- source tool WinCDEmu or proprietary freeware Daemon Tools exist. These emulate only CD or DVD drives. There are no any mass storage devices, such as hard disks or USB sticks emulated. However, the data can be in different image formats, such as are produced by various Windows - burning programs.

From Windows 7 disk images in the virtual hard disk format ( VHD format ) can be integrated using the Disk Management without additional utilities would be required. By means of the utility VHD tool raw images can be converted to the VHD format.

528687
de