LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Explanation of the "loop" option when mounting CD image files (http://www.linuxquestions.org/questions/linux-newbie-8/explanation-of-the-loop-option-when-mounting-cd-image-files-606948/)

uncle-c 12-15-2007 09:21 AM

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

matthewg42 12-15-2007 09:37 AM

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

uncle-c 12-15-2007 10:00 AM

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

matthewg42 12-15-2007 10:33 AM

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.

colucix 12-15-2007 10:36 AM

Quote:

Originally Posted by uncle-c (Post 299137)
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).

matthewg42 12-15-2007 12:16 PM

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.


All times are GMT -5. The time now is 03:52 AM.