Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.misc > #896

Re: HOW does 'loop' work ?

From no.top.post@gmail.com
Newsgroups alt.os.linux.slackware, comp.os.linux.misc
Subject Re: HOW does 'loop' work ?
Date 2011-04-24 11:28 +0000
Organization A noiseless patient Spider
Message-ID <ip11gp$imq$1@dont-email.me> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


References: <iohio5$rs4$1@dont-email.me>

In article <iohio5$rs4$1@dont-email.me>, Tauno Voipio <tauno.voipio@notused.fi.invalid> wrote: 

> On 17.4.11 5:17 , Tauno Voipio wrote:
> > no.top.post@gmail.com wrote:
> 
> Let's analyze your procedure:
> 
> >> An extract of `man losetup`, with my embedded queries, is:-
> >>> The following commands can be used as an example of using the loop
> >>> device. dd if=/dev/zero of=/file bs=1k count=100
-- snip--
> To create an unencrypted loop, use:
> 
>    losetup /dev/loop0 /file
-- snip--

> The files and directories are still in the disk/partition image 
> in /file, until you delete the file or mount the file system again 
> and delete them on the mounted node.

That's a complex concept; which is why not many people seem to
really know it. Lets:

-> losetup /dev/loop0 /tmp/LFile  == no such: /tmp/LFile  ?!
So losetup does not 'create' any file.
-> dd if=/dev/zero of=/tmp/LFile bs=1 count=88
-> losetup /dev/loop0 /tmp/LFile  == see all zero bytes
-> mkfs -t ext2 /dev/loop0 88 == see:
00001BF0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 
00001C00 02 00 00 00 0C 00 01 02 2E 00 00 00 02 00 00 00 ................ 
00001C10 0C 00 02 02 2E 2E 00 00 0B 00 00 00 E8 03 0A 02 ................ 
00001C20 6C 6F 73 74 2B 66 6F 75 6E 64 00 00 00 00 00 00 lost+found......
== see 'partition structure'
-> mount  /dev/loop0 /mnt/tmp
-> man losetup > /mnt/tmp/ml 
-> ls -l /mnt/tmp/ ==  ..
drwx------ 2 root root 12288 2011-04-21 22:47 lost+found 
-rw-r--r-- 1 root root 5740 2011-04-21 23:06 ml
== see: man losetup in the partition: /mnt/tmp/ !!

IMO the reason why this is little understood, is because of NOT
using a goal-directed explanation: "what is the purpose?".

"The loop mechanism allows building and populating a 'partition',
in a file, which could be in RAM. So that ... ? "

 I'm trying to understand the 'create a bootable sys
on eg. a USBstik' mechanism.

> /mnt resides in the main file system, and you do not see it when
> the other filesystem is mounted on it. The mounted file system
> you see on /mnt between mount and umount is the file system
> inside the loop target /file.
> You should re-read manuals of mount and losetup.

They don't [need to] explain why:
if you haven't got a device to give you a partition,
and you can only use RAM,
you should bother to simulate a physical device via 'loop'.

For making a bootable-USBstik,
why do they need to go via loop,
instead of just directly writing [cp & edit] to the USBstik.

A confusing fact, confirmed experimentally,
which may be relevant,
is that a 'new' `mount <device> /mnt`,
masks only PART of the previous '/mnt-tree'.

TIA

== Chris Glur

Back to comp.os.linux.misc | Previous | NextNext in thread | Find similar


Thread

Re: HOW does 'loop' work ? no.top.post@gmail.com - 2011-04-24 11:28 +0000
  Re: HOW does 'loop' work ? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2011-04-24 18:09 +0300
    Re (2): HOW does 'loop' work ? no.top.post@gmail.com - 2011-04-25 18:43 +0000
      Re: Re (2): HOW does 'loop' work ? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2011-04-25 22:36 +0300
      Re: Re (2): HOW does 'loop' work ? Kevin Snodgrass <kdsnodgrass@yahoo.com> - 2011-04-26 00:02 +0000
        Re (3): HOW does 'loop' work ? no.top.post@gmail.com - 2011-04-27 13:16 +0000
      Re: Re (2): HOW does 'loop' work ? Robert Nichols <SEE_SIGNATURE@localhost.localdomain.invalid> - 2011-04-25 22:16 -0500

csiph-web