Difference Between Soft Link & Hard Link
I would like to knoe the difference between SOFT LINK [Symbolic Link] & Hard link in solaris
|
do not use solaris but it should be the same as linux or unix
soft or symbolic is more of a short cut to the original file....if you delete the original the shortcut fails and if you only delete the short cut nothing happens to the original. hard link is more of a mirror copy....do something to file1 and it appears in file 2 deleting one still keeps the other ok |
aus9 explanation definitely applies to Solaris (a.k.a. Unix) too.
|
2 more differences:
Hard links share the same inode. Soft links do not. Hard links can't cross file systems. Soft links do. |
Quote:
John |
Quote:
|
On a hard disk there are lots of sectors.
Say a file starts at inode (sector) 4001 and ends at 5000. The file is "/export/home/john/mail.doc" Then: 1. A hard link to "mail.doc" which is named "hardLinkToMail" contains the value: "4001". 2. A soft link to "mail.doc" which is named "softLinkToMail" contains the value: "/export/home/john/mail.doc". In 1) the hard link can only point to the same disk. It can not point to another drive. All drives has an inode of value "4001", how can the hard link distinguish between all discs? Which drive's "4001" is it? In 2) the soft link contains a string. The string can point to another filesystem on another drive, because the full path is specified |
Is there something wrong with this forum? This thread has something like 9000 hits. The other threads has a couple of hundreds. 9000 hits sounds not plausible?
|
Nothing wrong with the forum. Here are a couple of reasons that can explain this popularity:
- This thread is three years old - Its title is a very common question |
|
SOFT LINK [Symbolic Link] & Hard link
Hard link point to the file content
while Soft link points to the file name. while size of hard link is the size of the content while soft link is having the file name size |
Difference Between Hard Link and Soft Link
Hard Link:
While creating a link from source to Destination file. ----> The changes done in the source file will be effected in destination file. But when The source file is deleted the destination file remains the same. Soft Link: While creating a link using soft link from source to destination file → the changes done in the source file will be effected in Destination file too. But when the source file is deleted the destination file also gets invisible. i.e when u tried to check the destination file its says no such file or directory Note: Its always best practice to give a hard link than soft link Hard Link syntax: ln file1 file2 Soft link Syntax: ln -s file1 file2 Thanks & Regards, Gopal Varma P |
Quote:
Quote:
Quote:
|
@jlliagre: Thanks for your much detailed points on this. Would like to request for the features like which are missing in Hard Links.
Thanks in advance Regards, Gopal Varma P |
Quote:
|
All times are GMT -5. The time now is 08:15 AM. |