LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Overlapping loop mounts? (https://www.linuxquestions.org/questions/slackware-14/overlapping-loop-mounts-752020/)

RaptorX 09-02-2009 04:17 AM

Overlapping loop mounts?
 
This is just a trivial question here...I would like to know:

I mount $SC/starcraft.iso in to /mnt/cdrom
I then mount $SC/broodwar.iso to /mnt/cdrom.

Are BOTH mounted at the same time but i can only access one of them?

the thing is that i get this:

Code:

[~]$ mount
[more]
tmpfs on /dev/shm type tmpfs (rw)
/dev/loop0 on /mnt/cdrom type iso9660 (rw)
/dev/loop1 on /mnt/cdrom type iso9660 (rw)

So both are mounted but of course i can only access one of them.
when I umount broodwar then I can access Starcraft...

So is that normal? :)

wildwizard 09-02-2009 05:22 AM

Yes.

When you mount a file system to a mount point the contents of that file system become the only files that exist at the mount point.

Any files that existed under the mount point before will be hidden by the newly mounted file system.

Try not to confuse the issue of mounting two file systems at the same mount point as that makes no difference only the order of the mounting counts.

trhodes 09-03-2009 05:05 AM

If you want to see both filesystems mounted at the same place:
http://slackbuilds.org/result/?search=aufs&sv=

UnionFS is another option, is somewhat harder to install, but is somewhat more featureful:
http://www.filesystems.org/project-unionfs.html

salasi 09-03-2009 07:41 AM

Quote:

Originally Posted by RaptorX (Post 3666530)

So is that normal? :)

As normal as a very normal thing. You probably want one of the options mentioned above, but another option -I don't know starcraft/broodwar, and what will work them- might be to use separate mount points for the two.

H_TeXMeX_H 09-03-2009 08:07 AM

I have noticed that in sw64 13.0 when you mount an iso as loopback you can't unmount it by trying to unmount the iso, you must unmount the '/dev/loop0'. It's kind of odd, because in the past you could use the name of the iso.

Still, you should not mount more than one thing in the same place.

bgeddy 09-03-2009 09:09 AM

Quote:

I have noticed that in sw64 13.0 when you mount an iso as loopback you can't unmount it by trying to unmount the iso, you must unmount the '/dev/loop0'. It's kind of odd, because in the past you could use the name of the iso.
I've just tried that as a test and noticed it in Slackware 13 (32 bit) . As you said it was different in 12 but I always unmount from the mount point so have not noticed this before.

If you look there is a difference in the record stored in /etc/mtab for the mount. SW 12 stores
Code:

/opt/VirtualBox/additions/VBoxGuestAdditions.iso /mnt/cdrom iso9660 rw,loop=/dev/loop0 0 0
for an iso mounted via the loop device. Slackware 13 shows :
Code:

/dev/loop0 /mnt/cdrom iso9660 rw 0 0
for a loop mounted iso. The mount command reports this difference.

RaptorX 09-03-2009 11:49 AM

well the question came since I expected that when I mount an iso on the same mount point as the other one (/mnt/cdrom in this case) then mount would automatically umount the previous fs that was in that mount point. I though that that was the "normal" behavior and was little startled when I had to umount TWICE to clean /mnt/cdrom...

I know unionfs (which slax uses) and I am planning to use it in a small personal pkg manager.
So it is not that i am looking forward to see both fs' in the same folder since I am aware that unionfs can give you that 'ability'.

bgeddy 09-03-2009 11:56 AM

Quote:

well the question came since I expected that when I mount an iso on the same mount point as the other one (/mnt/cdrom in this case) then mount would automatically umount the previous fs that was in that mount point.
Well I must admit I thought the same till I started experimenting given this thread. I too thought mounting something new to an already mounted mount point unmounted the previous mount and it was lost. I didn't think they "stacked up" like they seem to ! I think I'll be looking into this further as things like that interest me. I'm glad you brought this up !

RaptorX 09-08-2009 04:19 PM

no problem
:)

gnashley 09-09-2009 03:45 AM

bgeddy -you are onto something interesting. You can actually make thnigs in the lower mount point visible at the same time as those from the last mount -but not mixed like with unionfs.

Try something like this:
1. mount some partition on a given mount point.
2. create or copy some fs image into the mount point, if not already there.
3. use losetup to associate an fs image (*.iso or whatver) with a loop device
4. then mount a new partition on the original mount point. The fs image from above and any other files from the original mount are now invisible.
5. mount the loop device created above on a new mount point. Now you have access to the fs image file from the 'lower' mount point.

You can also, instead of using losetup, use the 'mount --bind ....' command to make the contents of the first mount visible through some other directory.

The use of losetup this way is pretty common in initrd's -you can associate files with devices and the devices are still available after doing switch_root. Fun stuff!


All times are GMT -5. The time now is 11:10 AM.