LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   loop interface? (https://www.linuxquestions.org/questions/linux-newbie-8/loop-interface-418143/)

bhomass 02-21-2006 05:12 PM

loop interface?
 
could someone give me an 101 on what is an "loop device" and "loop interface"? I kind of know it has something to do with 127.0.0.1. what's "loop" about it?

stress_junkie 02-21-2006 06:10 PM

There are really two kinds of devices that are referred to as loop<something>. The one that you mention is the network loopback interface. This is a virtual network interface. It is only a software device. It is often used to get a web browser to connect to the web server on the same machine. It is also used for diagnostics and for software development. If you run the ifconfig command you will see that one of the "interfaces" is named lo. That is the loopback network interface.
Code:

$ /sbin/ifconfig

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3006 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3006 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:150396 (146.8 Kb)  TX bytes:150396 (146.8 Kb)

As long as I mentioned that there are more loop<something> devices I may as well mention the other type. These are also virtual devices. They are addressed by way of the files in /dev/loop? where ? is a number. One use for these is to mount an iso file as a disk. For instance if you have an iso file called $HOME/my.iso you can mount it on /mnt with the following command.
Code:

$ mount -o loop $HOME/my.iso /mnt
Then you can look into the iso file just as if it were a mounted disk.
Code:

$ ls /mnt
If you try to write into the iso image you may or may not destroy the file structure.

:)

bhomass 02-21-2006 06:20 PM

sorry, I did not make the link between /dev/loop? and $HOME/my.iso. are you saying when I mount $HOME/my.iso as /mnt, a /dev/loop? is created at the same time? is it of any relevance that /dev/loop? is there? do people access the file thru /dev/loop?

so I understand the sense of "loop" in case of loop network interface. what's the loop is a mount -o loop?

stress_junkie 02-21-2006 07:02 PM

Quote:

Originally Posted by bhomass
sorry, I did not make the link between /dev/loop? and $HOME/my.iso. are you saying when I mount $HOME/my.iso as /mnt, a /dev/loop? is created at the same time?

There are already about 8 /dev/loop devices, numbered 0 through 7. The lowest numbered available loop device is automatically assigned to the my.iso file during the mount -o loop operation.

Quote:

Originally Posted by bhomass
is it of any relevance that /dev/loop? is there?

No.

Quote:

Originally Posted by bhomass
do people access the file thru /dev/loop?

Absolutely not. Access the file through the mount point. In this case that would be /mnt.

Quote:

Originally Posted by bhomass
so I understand the sense of "loop" in case of loop network interface. what's the loop is a mount -o loop?

The loop network interface has nothing to do with the /dev/loop devices. I'm sorry that I was not clear. Anyway, the network loop device has nothing to do with the /dev/loop devices. And, just to be thorough, the network loop device has nothing to do with the /dev/loop devices. :)

bhomass 02-21-2006 07:13 PM

I got that, loop network is not /dev/loop. my key question is why is a /dev/loop a "loop", in the usual English meaning of a "loop"?

stress_junkie 02-21-2006 07:29 PM

Quote:

Originally Posted by bhomass
I got that, loop network is not /dev/loop. my key question is why is a /dev/loop a "loop", in the usual English meaning of a "loop"?

I can only guess. Maybe it is because it is a virtual device rather than real hardware, but it is used in a role somewhat like a hardware device. In that respect it plays the same role for commands that expect to act on a hardware device as does the network lo loopback device.

bhomass 02-21-2006 07:37 PM

it must be a conspiracy to prevent English majors from entering the field.

I got your explanation down. thanks for the clarification. just want to be sure I did not miss any serious implications from the name.

stress_junkie 02-21-2006 07:46 PM

I think you are correct. I'm always getting angry at the choices that computer people have made in regard to naming things.


All times are GMT -5. The time now is 03:27 PM.