当前位置: 技术问答>linux和unix
请教mount loop
来源: 互联网 发布时间:2015-09-20
本文导语: mount -o loop boot.rom /mnt/xxx 什么意思?其中的loop到底有什么用的? | mount(1): THE LOOP DEVICE One further possible type is a mount via the loop device. For example, the command m...
mount -o loop boot.rom /mnt/xxx
什么意思?其中的loop到底有什么用的?
什么意思?其中的loop到底有什么用的?
|
mount(1):
THE LOOP DEVICE
One further possible type is a mount via the loop device. For example, the command
mount /tmp/fdimage /mnt -t msdos -o loop=/dev/loop3,blocksize=1024
will set up the loop device /dev/loop3 to correspond to the file /tmp/fdimage, and then mount this device on /mnt.
This type of mount knows about three options, namely loop, offset and encryption, that are really options to los-
etup(8). If no explicit loop device is mentioned (but just an option ‘-o loop’ is given), then mount will try to
find some unused loop device and use that. If you are not so unwise as to make /etc/mtab a symbolic link to
/proc/mounts then any loop device allocated by mount will be freed by umount. You can also free a loop device by
hand, using ‘losetup -d’, see losetup(8).
简而言之就是用一个文件系统中的普通文件虚拟成一个设备文件用于挂载的方法。
THE LOOP DEVICE
One further possible type is a mount via the loop device. For example, the command
mount /tmp/fdimage /mnt -t msdos -o loop=/dev/loop3,blocksize=1024
will set up the loop device /dev/loop3 to correspond to the file /tmp/fdimage, and then mount this device on /mnt.
This type of mount knows about three options, namely loop, offset and encryption, that are really options to los-
etup(8). If no explicit loop device is mentioned (but just an option ‘-o loop’ is given), then mount will try to
find some unused loop device and use that. If you are not so unwise as to make /etc/mtab a symbolic link to
/proc/mounts then any loop device allocated by mount will be freed by umount. You can also free a loop device by
hand, using ‘losetup -d’, see losetup(8).
简而言之就是用一个文件系统中的普通文件虚拟成一个设备文件用于挂载的方法。
|
可以拆分成两个步骤:
losetup /dev/loop1 boot.rom
mount /dev/loop1 /mnt/xxx
boot.rom 是一个普通文件,但是其内容包含文件内容
losetup /dev/loop1 boot.rom
mount /dev/loop1 /mnt/xxx
boot.rom 是一个普通文件,但是其内容包含文件内容