In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the losetup command in Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.
The Linux common command losetup command is used to set up looping devices. A circular device can virtualize files into block devices to simulate the entire file system, allowing users to treat them as devices such as hard drives, optical drives or floppy drives, and hang them as directories.
Losetup setting and Control cycle (loop) equipment
The syntax losetup [- e encryption] [- o offset] loop_device file losetup [- d] loop_device option-a shows the status of all looping devices. -d remove the equipment. -e start encryption coding. -f look for the first unused loop device. -o sets the data offset in bytes. Parameter loop_device: the loop device can be / dev/loop0, / dev/loop1... / dev/loop7 .
File: the file name to be associated with the circular device, which is often a disk mirror file, such as * .img
Loop device introduction in a UNIX-like system, a loop device is a pseudo device (pseudo-device), or can be said to be a simulation device. It enables us to access a file like a block device. A loop device must be connected to a file before it can be used. This combination provides users with an interface to replace block special files. Therefore, if the file contains a complete file system, the file can be mount like a disk device.
The file format mentioned above, what we often see is the ISO image of cd or DVD or the * .img image of floppy disk (hard disk). In this way of loop mount (mount), these images can be mount to a directory of the current file system.
At this point, by the way, we can understand the meaning of loop: for the first layer file system, it is installed directly on the physical device of our computer; and for this kind of image file which is mount (it also contains the file system), it is built on the first layer file system, so it looks like a file system that has circled again on the first layer file system, so it is called loop.
Instance to create an empty disk image file, and here create a 1.44m floppy disk:
Dd if=/dev/zero of=floppy.img bs=512 count=2880 uses losetup to virtualize disk image files into fast devices:
Losetup / dev/loop1 floppy.img mount block devices:
Mount / dev/loop0 / tmp after the above three steps, we can access the disk image file floppy.img through the / tmp directory as if we were accessing a real fast device.
Uninstall the loop device:
Umount / tmp losetup-d / dev/loop1 Thank you for reading this article carefully. I hope the article "how to use losetup commands in Linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.