Linux losetup command
Linux losetup command is used to set the loop device.
Loop device files can be put into a virtual block devices membership to simulate the entire file system, allowing users to be regarded as a hard drive, CD-ROM or floppy drive and other equipment, and as a link into the catalog to use.
grammar
losetup [-d][-e <加密方式>][-o <平移数目>][循环设备代号][文件]
Parameters:
- -d removable device.
- -e <encryption> Start encryption coding.
- -o <translation number> Set the number of data translation.
Examples
(1) Create an empty disk image file, created here a 1.44M floppy
$ dd if=/dev/zero of=floppy.img bs=512 count=2880
(2) use losetup virtual disk image file into a fast device
$ losetup /dev/loop1 floppy.img
(3) mounts all block devices
$ mount /dev/loop0 /tmp
After the above three steps, we can through the / tmp directory, such as fast access to real devices to access the same disk image file floppy.img.
(4) Uninstall loop equipment
$ umount /tmp $ losetup -d /dev/loop1