LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Query regarding hardlink and symbolic link. (https://www.linuxquestions.org/questions/linux-newbie-8/query-regarding-hardlink-and-symbolic-link-427145/)

tofee 03-21-2006 11:09 PM

Query regarding hardlink and symbolic link.
 
hello ,

is there any way to make a hardlink/symlink to a target file which has no existence ?

is it possible to make a symbolic link of a existing hardlink or vice versa ?

we know that symbolic link can be made in different partition but is it possible to make hardlink into different partition ?

pls explain the concept .... thanks in advance.

perfect_circle 03-21-2006 11:25 PM

Quote:

Originally Posted by tofee
is there any way to make a hardlink/symlink to a target file which has no existence ?

I don't think So...


Quote:

Originally Posted by tofee
is it possible to make a symbolic link of a existing hardlink or vice versa ?

Yes. but I cannot see a use for this


Quote:

Originally Posted by tofee
we know that symbolic link can be made in different partition but is it possible to make hardlink into different partition ?

No

pixellany 03-21-2006 11:29 PM

Quote:

Originally Posted by tofee
hello ,

is there any way to make a hardlink/symlink to a target file which has no existence ?

This makes no sense---what is the meaning of a link to a non-existent file? Did you mean EMPTY file? If so, then Yes...

Quote:

Originally Posted by tofee
is it possible to make a symbolic link of a existing hardlink or vice versa ?

Do you mean CONVERT from symbolic to hard? I don't think so.
Do you mean link to a link? Yes

Quote:

Originally Posted by tofee
we know that symbolic link can be made in different partition but is it possible to make hardlink into different partition ?

Yes

The concept?? A symbolic link is like a pointer--it redirects you to a real file. A hard link is like a mirror--the content is duplicated.

pixellany 03-21-2006 11:32 PM

Quote:

Originally Posted by perfect_circle
No

Said in response to hardlink in different partition...

I misread OP as saying "directory" and answered "yes". Why would it not work in a different partition?

perfect_circle 03-21-2006 11:48 PM

Quote:

Originally Posted by pixellany
Said in response to hardlink in different partition...

I misread OP as saying "directory" and answered "yes". Why would it not work in a different partition?

A simlink is just a new file that somehow has inside it stored the path to a real file.

A hard link creates a copy of the i-node of the file. Hard link is not a link in the way you imagine it.

When you create a hard link what you do is have a second i-node pointing to the same data.

[i-node]-> [file data] <- [i-node]

To have a hard link in a different partition is like having a file half of which is stored in a different partition. This is not feasible.

perfect_circle 03-21-2006 11:51 PM

http://www.granneman.com/techinfo/li...dhardlinks.htm

Quote:

Soft links

* Pointers to programs, files, or directories located elsewhere (just like Windows shortcuts)
Quote:

Hard links cannot span disk drives, so you CANNOT have a hard link on /dev/hdb that refers to a program or file on /dev/hda
If you want a piece of advice, don't use hard links

maxie 03-22-2006 12:52 AM

I´ve never had a reason to use hard links.
Is there an example?
What about... data in a shared folder.
user a has a hard link in his home to shared
user b also has a hard link in his home to shared
Is this like it?

mbreith 03-22-2006 01:03 AM

As I understand it, yes. What I don't know is if the two hard links can have different permissions. Then user A and user B can both be owners of the same file. That is the only reason I can see to have hard links.


All times are GMT -5. The time now is 01:08 AM.