LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 12-15-2007, 08:21 AM   #1
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296

Rep: Reputation: 30
Explanation of the "loop" option when mounting CD image files


Hi there,
I've read that one can mount CD iso files using the mount command e.g.

Code:
# mount -t iso9660 -o ro,loop=/dev/loop0 cd.iso /mnt/cdrom
Could someone kindly explain the purpose and function of the loop=/dev/loop0 section of the command and why it is explicitly used when mounting cd ISOs ? I always find it's role a mystery

Seasons greetings,

Uncle-c
 
Old 12-15-2007, 08:37 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
The loop option means loop-back. Since there is no real device file in /dev for filesystems which exists only inside in a file, the kernel provides these loopback devices which act as a conduit for the filesystem-in-a-file.

I think it's not usually necessary to specify which one to use - you can usually just say "-o loop". Also, the ro option (readonly) is not necessary as the CD filesystem cannot be written to anyway. Lastly, the filesystem type will probably be determined automatically, so you might not need the -t option either. Hence this should do the same thing as your command with a little less typing:
Code:
# mount -o loop cd.iso /mnt/cdrom
 
Old 12-15-2007, 09:00 AM   #3
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296

Original Poster
Rep: Reputation: 30
Thanks matthew ! Is there any other scenario a linux user could encounter which involves mounting using the loop option ? One which does not involve iso / CDs.

Thanks again !

uncle
 
Old 12-15-2007, 09:33 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
You might have an image of hard disk (a byte-for-byte copy of the whole device or partition to a file). You can mount these images using the loop option.
 
Old 12-15-2007, 09:36 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Quote:
Originally Posted by uncle-c View Post
Is there any other scenario a linux user could encounter which involves mounting using the loop option?
I used loop-back devices to setup a disk space with quotas (see this post for a more detailed explanation) or to share some directories on a file server to make them available to specific users only (without data replication).
 
Old 12-15-2007, 11:16 AM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
You might also use a loopback device to have an encrypted filesystem in a file with sensitive document is, although there's no reason to use a loopback other than as an alternative to a real partition.

An alternative to this is to use the fuse-based EncFS.
 
  


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 10:35 AM
Mounting with "-o loop" PaulFXH Linux - General 14 07-25-2007 04:20 AM
"Shutdown" and "Restart" option missing after upgrade hansalfredche Mandriva 8 11-02-2006 07:23 AM
What does "loop-mount the disk image" mean ? karans Linux - Distributions 1 10-29-2003 08:21 AM
anging "Protocol" option to "IMPS/2" in XF86Config-4 causes problems zstingx Linux - General 2 10-27-2003 09:47 AM


All times are GMT -5. The time now is 08:04 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration