1756641 Members
2613 Online
108849 Solutions
New Discussion юеВ

Re: Linking directory

 
SOLVED
Go to solution
stevegray
Frequent Advisor

Linking directory

I have HP-UX 11.0.

I want /data/WFS linked to a larger file system called /data1/WFS.

When I create a link:
ln -s /data1/WFS /data/WFS
it does not apear to work.

It looks like:
lrwxrwxr-x 1 titan titan 10 Mar 3 03:45 WFS -> /data1/WFS

But when I do a >test it stays in /data/WFS instead of going to /data1/WFS.

What am I doing wrong or not understanding?

12 REPLIES 12
Mark Grant
Honored Contributor

Re: Linking directory

How do you know it is still in /data/WFS? Most commands that will look in /data/WFS will actually follow the symbolic link and even "pwd" will lie to you.

If you do "cd /data1/WFS" and then "ls" is your file there?

If so, then everything is working.
Never preceed any demonstration with anything more predictive than "watch this"
Dennis Handly
Acclaimed Contributor

Re: Linking directory

>Mark: even pwd will lie to you.

If you want to keep pwd(1) honest, you need to use "pwd -P".

>If you do "cd /data1/WFS" and then "ls" is your file there?

Right, or do: bdf .
stevegray
Frequent Advisor

Re: Linking directory

I am in /data/WFS. I do a >test.
The file test shows up in /data/WFS and not in /data1/WFS/test.

Their is a sub-directory under /data1/WFS called in. This is the directory where users put their data.

This is how I did the setup:
mv /data/WFS /data1/WFS
This moved everything to the new directory. It removed the sub-directory in /data/WFS. It is /data1/WFS.

The link command I ran is:
ln -s /data1/WFS/ data/WFS
stevegray
Frequent Advisor

Re: Linking directory

SOrry I cannot type today. The link command was:
ln -s /data1/WFS /data/WFS
Yogeeraj_1
Honored Contributor

Re: Linking directory

Hi,

can you post the output of the following command:
ll /data*

revert

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
stevegray
Frequent Advisor

Re: Linking directory

Here you go.

$ pwd
/data/WFS
$ ll /data/*
/data/RP: total 0
drwxrwxrwx 4 titan titan 96 Feb 2 15:36 2
/data/VS:
total 0
drwxrwxr-x 4 titan titan 96 Feb 2 15:32 2
drwxrwxr-x 4 titan titan 96 Feb 2 15:33 3
/data/WFS:
total 0
lrwxrwxr-x 1 titan titan 10 Mar 3 03:45 WFS -> /data1/WFS
drwxrwxr-x 2 titan titan 96 Mar 3 04:17 in
/data/lost+found:
total 0
Dennis Handly
Acclaimed Contributor
Solution

Re: Linking directory

/data/WFS:
lrwxrwxr-x Mar 3 03:45 WFS -> /data1/WFS

This is your problem. You created WFS and then you put another WFS into WFS/.

So
$ rm /data/WFS/WFS
$ rmdir /data/WFS
$ ln -s /data1/WFS /data/WFS

>Sorry I cannot type today. The link command was: ln -s /data1/WFS /data/WFS

That's what you had??
stevegray
Frequent Advisor

Re: Linking directory

This looks better.

I was in /data/WFS
I did >test

It showed up in /data/WFS and in /data1/WFS

Why is it showing up in /data/WFS?
$ pwd
/data/WFS
$ ll /data* /data:
total 0
drwxrwxrwx 3 titan titan 96 Feb 2 15:36 RP
drwxrwxr-x 4 titan titan 96 Feb 2 15:33 VS
lrwxrwxr-x 1 titan titan 10 Mar 3 04:44 WFS -> /data1/WFS
drwxr-xr-x 2 titan titan 96 Jan 15 05:20 lost+found
/data1:
total 0
drwxrwxrwx 3 titan titan 96 Mar 3 04:47 WFS
drwxr-xr-x 2 titan titan 96 Feb 29 04:03 lost+found


$ ll /data*

/data:
total 0
drwxrwxrwx 3 titan titan 96 Feb 2 15:36 RP
drwxrwxr-x 4 titan titan 96 Feb 2 15:33 VS
lrwxrwxr-x 1 titan titan 10 Mar 3 04:44 WFS -> /data1/WFS
drwxr-xr-x 2 titan titan 96 Jan 15 05:20 lost+found

/data1:
total 0
drwxrwxrwx 3 titan titan 96 Mar 3 04:47 WFS
drwxr-xr-x 2 titan titan 96 Feb 29 04:03 lost+found
$ ll /data/*
lrwxrwxr-x 1 titan titan 10 Mar 3 04:44 /data/WFS -> /data1/WFS
/data/RP: total 0
drwxrwxrwx 4 titan titan 96 Feb 2 15:36 2
/data/VS: total 0
drwxrwxr-x 4 titan titan 96 Feb 2 15:32 2
drwxrwxr-x 4 titan titan 96 Feb 2 15:33 3 /data/lost+found: total 0
Dennis Handly
Acclaimed Contributor

Re: Linking directory

>Why is it showing up in /data/WFS?

It's a symlink, so it should be in "both".

>$ pwd

I told you to use "pwd -P" to prevent the shell from lying to you.

$ ll /data*
/data:
lrwxrwxr-x 1 10 WFS -> /data1/WFS
/data1:
drwxrwxrwx 3 96 WFS

This is working fine. You have a symlink /data/WFS that points to /data1/WFS/.