LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

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: 65
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: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

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: 65
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
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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: 65
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



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 7 12-19-2015 01:03 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 PM.

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
Open Source Consulting | Domain Registration