Discussion:
How to Create a Symbolic Link to a Mounted Volume
Dom Incollingo
2009-01-31 17:38:50 UTC
Permalink
I mounted a home directory from another computer via sftp. The directory is
mounted as:

sftp://dji at linux/home/dji.

I tried to make a symbolic link to this directory by running the command

ln -s sftp://dji at linux/home/dji anotherHome

But the link that is created (anotherHome) is not usable. How can I create
a symbolic link to a a mounted volume?

Thanks very much.

Dom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090131/41be8a02/attachment.html>
Markus Schönhaber
2009-02-01 01:11:44 UTC
Permalink
Post by Dom Incollingo
I mounted a home directory from another computer via sftp. The directory is
sftp://dji at linux/home/dji.
I doubt that it's mounted there. That's an URL you can, for example,
type into Nautilus' location bar to access this resource.
Type
mount
to see a list of what is mounted where.
Post by Dom Incollingo
I tried to make a symbolic link to this directory by running the command
ln -s sftp://dji at linux/home/dji anotherHome
But the link that is created (anotherHome) is not usable. How can I create
a symbolic link to a a mounted volume?
You can't create usable symlinks pointing to somewhere outside the
filesystem tree.
OTOH: if you use Gnome and did use Nautilus to access this URL, the gvfs
will by default make the root of the remote filesystem accessible trough
a directory below ~/.gvfs. You should be able to create a usable symlink
pointing there.

Out of curiosity: why do you want to do that?

Regards
mks
Derek Broughton
2009-02-01 01:42:28 UTC
Permalink
Post by Markus Schönhaber
Post by Dom Incollingo
I mounted a home directory from another computer via sftp. The directory
sftp://dji at linux/home/dji.
I tried to make a symbolic link to this directory by running the command
ln -s sftp://dji at linux/home/dji anotherHome
You can't create usable symlinks pointing to somewhere outside the
filesystem tree.
Of course, you really can, but the other filesystem must be _mounted_ into
your hierarchy. My /etc/fstab has a number of entries like:
//DOMAIN/SHARE /home/derek/DOM_MOUNT cifs \
noauto,user,credentials=/home/derek/.cred,rw 0 0

and after I "mount ~/DOM_MOUNT" I can treat it like a local mount -
including making symlinks to files in its own filesystem.
...
Post by Markus Schönhaber
Out of curiosity: why do you want to do that?
Because you can? :-)

Seems to me that a great deal of effort has been put into both KDE & Gnome to
make it possible to treat remotely "accessed" (as opposed to explicitly
mounted) filesystems as if they're local.

The problem in this case is that, as Markus points out, it's something that
_Gnome_ can do (and I'd just like to mention that KDE has been able to do it
for much longer!) but if you're working in the CLI at the level of "ln",
then you're working at the same level as "mount", and you need the filesystem
explicitly mounted before you can do things like that.
Markus Schönhaber
2009-02-01 15:22:00 UTC
Permalink
Post by Derek Broughton
Post by Markus Schönhaber
Post by Dom Incollingo
I mounted a home directory from another computer via sftp. The directory
sftp://dji at linux/home/dji.
I tried to make a symbolic link to this directory by running the command
ln -s sftp://dji at linux/home/dji anotherHome
You can't create usable symlinks pointing to somewhere outside the
filesystem tree.
Of course, you really can,
No, you can't (notice the word "useful").
Post by Derek Broughton
but the other filesystem must be _mounted_ into
your hierarchy.
Which means that it's *not* *outside* filesystem tree any more.
Post by Derek Broughton
//DOMAIN/SHARE /home/derek/DOM_MOUNT cifs \
noauto,user,credentials=/home/derek/.cred,rw 0 0
and after I "mount ~/DOM_MOUNT" I can treat it like a local mount -
including making symlinks to files in its own filesystem.
I already gave the OP one possible solution to create a symlink that is
actually usable pointing to the sftp server's file system.
Post by Derek Broughton
Post by Markus Schönhaber
Out of curiosity: why do you want to do that?
Because you can? :-)
OK, valid explanation. But it still leaves me curious.
Post by Derek Broughton
Seems to me that a great deal of effort has been put into both KDE & Gnome to
make it possible to treat remotely "accessed" (as opposed to explicitly
mounted) filesystems as if they're local.
The problem in this case is that, as Markus points out, it's something that
_Gnome_ can do (and I'd just like to mention that KDE has been able to do it
for much longer!) but if you're working in the CLI at the level of "ln",
then you're working at the same level as "mount", and you need the filesystem
explicitly mounted before you can do things like that.
Well, as I already pointed out in my previous post, GVFS creates
something that is actually usable as a target for ln -s. Although typing
"sftp://<something>" into Nautilus' location bar doesn't really mount
the remote filesystem separately, it's made accessible through a folder
below ~/.gvfs which itself is indeed a mount point.
But that's just nitpicking: I agree that it may not bee too desirable in
the long run to rely on a mix of GUI and command line tools.
I'm too lazy to check now, but I'd be surprised if no-one had written
something (for example using FUSE) that really mounts a sftp filesystem,
which might be a more adequate tool for the job.

Regards
mks
Derek Broughton
2009-02-01 18:47:52 UTC
Permalink
Post by Markus Schönhaber
Post by Derek Broughton
Post by Markus Schönhaber
Post by Dom Incollingo
I mounted a home directory from another computer via sftp. The
sftp://dji at linux/home/dji.
I tried to make a symbolic link to this directory by running the command
ln -s sftp://dji at linux/home/dji anotherHome
You can't create usable symlinks pointing to somewhere outside the
filesystem tree.
Of course, you really can,
No, you can't (notice the word "useful").
Well, you didn't actually _say_ "useful", you said "usable", and yes,
they're definitely usable. I maintain that they're also _useful_.
Post by Markus Schönhaber
Post by Derek Broughton
but the other filesystem must be _mounted_ into
your hierarchy.
Which means that it's *not* *outside* filesystem tree any more.
Well, now, that's an interesting splitting of hairs - in fact they are, by
any definition I've ever read outside the _filesystem_ - they're in your local
directory tree, yes, but not your _filesystem_ tree. I'd have no
disagreement if you'd said "filesystems tree".
Post by Markus Schönhaber
Post by Derek Broughton
//DOMAIN/SHARE /home/derek/DOM_MOUNT cifs \
noauto,user,credentials=/home/derek/.cred,rw 0 0
and after I "mount ~/DOM_MOUNT" I can treat it like a local mount -
including making symlinks to files in its own filesystem.
I already gave the OP one possible solution to create a symlink that is
actually usable pointing to the sftp server's file system.
Yes you did. And I agree with it. That doesn't mean that the above isn't a
useful or usable concept.
Post by Markus Schönhaber
I'm too lazy to check now, but I'd be surprised if no-one had written
something (for example using FUSE) that really mounts a sftp filesystem,
which might be a more adequate tool for the job.
I didn't find anything while looking at FUSE filesystems last week, but then I
wasn't specifically looking for ftp:
Dom Incollingo
2009-02-02 02:05:21 UTC
Permalink
Post by Markus Schönhaber
OTOH: if you use Gnome and did use Nautilus to access this URL, the gvfs
will by default make the root of the remote filesystem accessible trough
a directory below ~/.gvfs. You should be able to create a usable symlink
pointing there.
Out of curiosity: why do you want to do that?
Thanks very much for the information. I found the file system mounted in
the ~/.gvfs/ directory, and I made a symlink to it. It worked like a charm.

As far as why I wanted a symlink.... I'm running a Java app under JBoss,
and have been having problems with it. One of my co-workers suggested
having JBoss point to a symlink for the remote file structure it needs to
access. (Possibly because of the embedded spaces in the name of the file
structure name mounted in ~/.gvfs ??)

At any rate, the app is running fine now, and I now know how to find the
place where Gnome is actually mounting the volume. Thank again for your
help and comments.

Dom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090201/409188d3/attachment.html>
Markus Schönhaber
2009-02-02 10:06:06 UTC
Permalink
Post by Dom Incollingo
Thanks very much for the information. I found the file system mounted in
the ~/.gvfs/ directory, and I made a symlink to it. It worked like a charm.
Good to hear you got it working.
Post by Dom Incollingo
As far as why I wanted a symlink.... I'm running a Java app under JBoss,
and have been having problems with it. One of my co-workers suggested
having JBoss point to a symlink for the remote file structure it needs to
access. (Possibly because of the embedded spaces in the name of the file
structure name mounted in ~/.gvfs ??)
I overcame my laziness and took a quick look at the Ubuntu repositories.
There is indeed a FUSE-based tool to really mount SFTP-resources: sshfs[1].
That might be a better choice for the job since you have control about
where things get mounted and you can obviously avoid having spaces in
the name of the mount point.
Post by Dom Incollingo
At any rate, the app is running fine now, and I now know how to find the
place where Gnome is actually mounting the volume. Thank again for your
help and comments.
You're welcome

Regards
mks

[1] There may be others, too. sshfs was simply the first I saw and it
seems to be working well.

Loading...