LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This 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


Reply
  Search this Thread
Old 03-05-2004, 12:36 AM   #1
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Rep: Reputation: 15
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.
 
Old 03-05-2004, 01:26 AM   #2
hiteshmaisheri
Member
 
Registered: Nov 2003
Location: Kerala, India
Distribution: Red Hat, Knoppix, Mandrake, FreeBSD
Posts: 231

Rep: Reputation: 30
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...
 
Old 03-05-2004, 02:46 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
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.
 
Old 03-07-2004, 09:20 AM   #4
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Original Poster
Rep: Reputation: 15
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!!!
 
Old 03-07-2004, 04:05 PM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
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.
 
Old 03-07-2004, 06:11 PM   #6
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Original Poster
Rep: Reputation: 15
Okay, thanks. This has been a very enlightening experience!
 
Old 03-08-2004, 10:02 AM   #7
hiteshmaisheri
Member
 
Registered: Nov 2003
Location: Kerala, India
Distribution: Red Hat, Knoppix, Mandrake, FreeBSD
Posts: 231

Rep: Reputation: 30
Thank you for guiding through my mistake... i am sorry for misleading kde4me... i am very very sorrry....
 
Old 07-23-2004, 09:01 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
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
 
Old 01-22-2012, 05:01 AM   #9
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
and for the record, here is how you can do it on Linux:
Code:
mount --bind olddir newdir
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fstab and lofs kaplan71 Fedora 1 05-18-2005 08:51 PM
The best command for "extracting" a loopback filesystem Tsuroerusu Linux - Software 2 02-12-2005 07:58 AM
DISCUSSION: Virtual Filesystem: Building a Linux Filesystem from an Ordinary File mchirico LinuxAnswers Discussion 0 10-28-2004 10:35 PM
Need help with loopback filesystem x12344321 Linux - Software 1 01-24-2004 03:21 PM
Mount Loopback filesystem on an entire HD image? wartstew Linux - General 0 01-24-2003 07:46 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration