LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-21-2006, 05:12 PM   #1
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Rep: Reputation: 15
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?
 
Old 02-21-2006, 06:10 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
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.


Last edited by stress_junkie; 02-21-2006 at 06:14 PM.
 
Old 02-21-2006, 06:20 PM   #3
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Original Poster
Rep: Reputation: 15
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?
 
Old 02-21-2006, 07:02 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
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.
 
Old 02-21-2006, 07:13 PM   #5
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Original Poster
Rep: Reputation: 15
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"?
 
Old 02-21-2006, 07:29 PM   #6
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
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.

Last edited by stress_junkie; 02-21-2006 at 07:33 PM.
 
Old 02-21-2006, 07:37 PM   #7
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Original Poster
Rep: Reputation: 15
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.
 
Old 02-21-2006, 07:46 PM   #8
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
for loop only works properly on first loop symo0009 Programming 1 12-25-2005 05:17 PM
while loop or for loop? mijohnst Programming 18 11-21-2005 04:48 PM
System is hanging at :BRinging up loop back interface" svyshna Linux - General 1 09-21-2003 06:54 PM
for loop klfreese Programming 16 08-11-2003 11:09 AM
Loop back Interface siddiqu Linux - Networking 2 11-17-2001 08:34 PM


All times are GMT -5. The time now is 08:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration