Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90
Rep:
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?
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...
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
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.
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90
Original Poster
Rep:
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..?
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
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.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.