Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am doing a mounting of an iso file and looking at this tutorial. They use the command:

$ mount -o loop disk1.iso /mnt/disk

I'm trying to understand the use of -o loop. So I have two questions:

When I look at the long man page for mount, it takes time to find that -o option. If I do man mount | grep "-o" I get and error, and when I look in the file I do not find info that "loop" is a command text for option -o. Where is that documented?

Also, what is the "loop device" concept for mounting? Even a good link to an explanation would be appreciated.

share|improve this question

2 Answers 2

up vote 15 down vote accepted

loop device is a pseudo ("fake") device (actually just a file) that acts as a block-based device. You want to mount a file (disk1.iso) that will act as entire filesystem, so you use loop.

The -o comes from the -options.

And the last thing, if you want to search for "-o" you need to escape the '-'. Try:

man mount | grep "\-o"
share|improve this answer
    
With GNU grep, grep -e -o (-e says "next thing is the pattern no matter what it looks like) or grep -- -o (-- means stop looking for switches) work too. Of course feel free to use whatever works for you. –  ephemient Dec 6 '10 at 0:26
2  
You can also just type: man mount, and then you can use /-o to search for and highlight all instances of "-o" –  Josh Dec 7 '10 at 14:21

Traditionally, UNIX systems have had various types of nodes in their filesystems:

  • directory
  • file
  • symlink
  • block device
  • character device
  • FIFO
  • UNIX domain socket

While there are now exceptions, generally block devices containing filesystems are mounted on directories.

Since you want to mount a file, you must first create a loop block device that is backed by the file. This can be done using losetup, but mount -o loop is a shortcut that handles that behind the scenes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.