LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Why Loopback filesystem - lofs? (https://www.linuxquestions.org/questions/solaris-opensolaris-20/why-loopback-filesystem-lofs-153697/)

KDE4me 03-05-2004 12:36 AM

Why Loopback filesystem - lofs?
 
Hi Everybody,

I was just reading about loopback filesystem(lofs) and I was just wondering why in gods name I would want to use it. Has anybody here got a good example of how to use it? At the moment I can't really see any benefit of mirroring the filesystem elsewhere in the fs tree. Is it just something that's there for no apparent reason?

Thanks in advance.

hiteshmaisheri 03-05-2004 01:26 AM

lofs helps to you work on network services without having a network card is what i have know as of now... in search of more information ... if you get more enofrmation then do post a reply to this thread.... thank you...

jlliagre 03-05-2004 02:46 AM

hiteshmaisheri is confusing lofs with the network loopback device (lo0).

lofs is there to allow to map a file to a virtual device.

One very useful purpose of it is that you can take a cdrom image file (.iso) and mount it on the file system to then access it without the need to record a CD-R.

It is somewhat equivalent to the linux "mount -o loop" option, but adds a level of abstraction: you can do most commands that apply to a device to the mapped file, while with linux you can only mount the file.

KDE4me 03-07-2004 09:20 AM

Hey thanks for that jlliagre,
It does seem quite useful now. Just one question, when you say "you can do most commands that apply to a device to the mapped file, while with linux you can only mount the file" do you mean that you can do things like:
$badblocks /mnt/lofs or fsck /mnt/lofs (Sorry I'm not sure if these commands exist on Solaris -- I'm on a linux box at the moment) and commands like cp etc.
whereas on linux you can only use commands like cp but not fsck..?

Thanks for your help, it's greatly appreciated!!!

jlliagre 03-07-2004 04:05 PM

Badblocks would be useless, as the mapped file cannot have bad blocks in it and in fact there is no such command with solaris.
You can fsck the file, and newfs/mkfs it, but this is not a difference from Linux.

One command I was thinking of is "iostat -d /dev/lofi/1", this command applies to a device, and has no meaning with a file.
I don't know if its equivalent exists with linux though.

KDE4me 03-07-2004 06:11 PM

Okay, thanks. This has been a very enlightening experience!

hiteshmaisheri 03-08-2004 10:02 AM

Thank you for guiding through my mistake... i am sorry for misleading kde4me... i am very very sorrry....

jlliagre 07-23-2004 09:01 AM

Ooops ....

four month later, I realize I was also myself confusing loopback thingies ...

To make it clear, there are three of these:

lo: the loopback network pseudo interface, bound to IP 127.0.0.1, used to run network programs without actually leaving the computer. Everything sent to this interface returns from it as is. This what hitesmaisheri was talking about.

lofi: the loopback file driver, allowing to use a file as if it was a disk device. This is closed to the Linux "-o loop" mount option. This is what I described in my previous postings in this thread BUT ... the original question was about:

lofs: the loopback file system, allowing to mount an arbitrary directory to another directory, more or less like a symbolic link. There are some situations where this loopback mount is superior to a symbolic link, for example "ro" option can be set during the mount, limiting the damages that can be done. It is also used in chrooted environments where a symlink should have been useless. Lastly, with solaris zones, it plays a role similar to the chroot situation.

Wow, I feel better now :D

jlliagre 01-22-2012 05:01 AM

and for the record, here is how you can do it on Linux:
Code:

mount --bind olddir newdir


All times are GMT -5. The time now is 05:30 AM.