Loop device

from Wikipedia, the free encyclopedia

Under Unix-like systems, one is loop device (or English loop back device ), a virtual block device that corresponds to any physical device, but as the underlying storage uses a file. Since the operating system kernel can only mount file systems that are located on block devices, loop devices are usually used to integrate file system images that are available as files.

This method is useful wherever real data carriers are to be simulated, e.g. B. because the use of physical devices is too expensive, too cumbersome, too slow or undesirable for other reasons.

With the help of loop devices and special drivers, file systems can also be transparently compressed or encrypted, e.g. B. with cloop or dm-crypt .

Examples

Mounting a hard disk image in the file tree basically requires two steps:

  1. The file containing the hard disk image is linked to a device node in the special directory / dev (command losetup).
  2. This special device (loop device) is attached to the file tree under a directory (command mount).

These two steps can either be carried out separately or, by specifying appropriate options, mountthey can be carried out together with a single call to the utility program. The first step can be carried out with the command losetupunder Linux or lofiadmunder SunOS. If there is beispiel.imga normal file that contains an image with a file system and is /mnt/verzeichnisa directory on a Linux computer, the system administrator ( super user ) can execute the following commands:

losetup /dev/loop0 beispiel.img
mount /dev/loop0 /mnt/verzeichnis

The first command links the loop device node /dev/loop0with the normal file beispiel.img. The second command attaches this pseudo-device to /mnt/verzeichnisthe file tree, as if it were /dev/loop0a normal hard disk or a hard disk section ( partition ).

The utility mountis able to perform the entire procedure in a single step:

mount -o loop beispiel.img /mnt/verzeichnis

The device can be unmounted in both cases using the command

umount /mnt/verzeichnis

Microsoft Windows

For Windows there are e.g. B. the open source WinCDEmu or the proprietary freeware Daemon Tools . These only emulate CD, DVD or Blu-ray drives and thus - unlike the loop device - no arbitrary mass storage devices such as hard drives or USB sticks. The data can, however, be available in different image formats, such as those generated by different Windows burning programs. As of Windows 8 , ISO files can be integrated directly without additional programs.

The freeware OSFMount can also send hard disk images (e.g. from Unixdd). As of Windows 7 , hard disk images in virtual hard disk format can be assigned a drive letter via disk management. I.a. With the help program VHD tool , raw data images can be converted into the VHD format.

Web links

credentials

  1. losetup manual page
  2. lofiadm, Sun System Administration Command manual ( Memento of the original from July 31, 2009 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / docs.sun.com
  3. http://osforensics.com/tools/mount-disk-images.html
  4. http://code.msdn.microsoft.com/vhdtool