Recently learned about the loopback file system for Linux. It's really interesting.
The so-called loopback file system, which is different from the conventional file system, the general file system is built on the device, and it is built in the file.
Regardless of the file system, it needs to be mounted before it can be used.
Check out the loopback file system below.
First of all, we should create an empty file, whatever name you can take.
DD If=/dev/zero of=image.img bs=1g count=1 #可能有别的方式创建吧, but I only know with DD
The above command means creating an empty file with a size of 1G.
Then, create the file system.
MKFS.EXT4 image.img
In this case, a loopback file system is created successfully. Let's see how we can use it. It's so exciting. Resources have finally been stored somewhere in the future.
The device needs to be mounted before it can be used. Then we need to mount the device.
Mount-o Loop image.img/mnt/img #假定已经创建了img文件夹
Then this loopback file system is created and mounted successfully.
There is another way to mount the loopback file system, and it is more extensive.
LOSETUP/DEV/LOOP1 image.img #相当于建立一个映射, map loopback files to device files
Mount/dev/loop1/mnt/img
Let's take a look at the example:
Good drop, the loopback file is finished, is it possible to retire the mobile hard drive? After all, this thing is better hidden.
Now let's introduce the ISO image file. I've learned three ways to create this stuff.
The first two are created from device files. Later, you can create a city ISO file from any normal file.
1. Cat/dev/cdrom Image.iso
2. DD If=/dev/cdrom Of=image.iso
3. Mkisofs-v "lable"-o image.iso/dir #-v Specifies the volume label.-o Specifies the output file name. /dir represents the source folder. That is, if you want to summarize the files into an ISO image, put them in the same folder.
ISO The most we can use is to install the system. The ISO that is created in the three above methods is not enough to be placed on the mobile device, because there is no boot information. Therefore, additional boot information is required. That is, the so-called hybrid ISO file.
The Isohybrid command can help us achieve this goal. Try it.
You only need to execute Isohybrid image.iso. This file can already be launched as a USB stick. Then copy the files to the mobile device.
DD If=image.iso of=/dev/sdb1 #或者 cat IMAGE.ISO/DEV/SDB1
The above introduction of the USB flash drive mode I did not go to the field to test. Just keep it in mind. So, if the test is unsuccessful, don't scold me. Also be sure to back up your mobile device files.
There is also a command that can be used to create a mixed ISO file.
Cdrecord: no introduction. I don't know much about it. I always can't remember the use of this command. Ashamed.
Let's summarize so much. Hope to the students of advanced education to help. Of course, if the students have a more advanced way, but also hope to enlighten ah.
Linux loopback files and ISO file learning summary