Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-25-2009, 11:09 AM   #1
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
Question related to hard link.

I have a question related to hard link. I can understand the difference between soft link and hard link. But I wish to know what is the advantage of hard link. In the resources I have, it is mentioned that soft link is more advantageous since it is easy to change files and we can put a soft link to those files, also it is easy to identify an original file and its soft link ,but it is not possible to identify a hard link to an original file unless we know the inode numbers of the 2 files are the same.
With these disadvantages, why we are using hard link? Is it because it is useful in the programing side?
Also please let me know, what does it mean that "Hard link cannot be made to a different file system, but soft link can be made to a different file system"
Old 01-25-2009, 11:16 AM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Well .... the advantage of a hard-link is that as long
as at least one link exists, the file is physically there.

With a soft link, if you delete the original, the soft
link points into the void.

As for the question regarding "different file system":
If your hdd is partitioned, and e.g. parts reside on / (e.g.
sda1 and others on /usr (e.g. sda6), you can't make a hard
link from something on / to /usr, or vice versa.

Old 01-25-2009, 11:21 AM   #3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I don't use hard links, so I can only guess why they would be needed. Try this: "Any time that you need two references to the same data, such that either one can be deleted without losing the data."

Also please let me know, what does it mean that "Hard link cannot be made to a different file system, but soft link can be made to a different file system"
Again....only guessing. I would assume for the same reason that you cannot create a filename on one filesystem that points to an inode on another.

Another way to look at it:
A hard link is another name for the same data
A soft link is a pointer to the data
Old 01-25-2009, 07:19 PM   #4
Registered: Jan 2009
Posts: 100

Rep: Reputation: 17
You can set up hard links to an executable for several users in their home directories. If one of the users doesn't want to have that executable in the home directory, he/she can delete it. The other links are not affected, the executable till does exist, and it only takes disk space of a single copy.
Some users do not like softlinks to locations they do not understand or references to applications in root-protected locations like /bin - they simply feel they have to own the application by having in their own directory tree. It's also better as having hundreds of copies of the same executables, eating up disk space for the same thing. It is a preferred link type when maintaining accounts for non-technical people.


Last edited by servat78; 02-19-2009 at 11:15 AM.
Old 01-25-2009, 10:29 PM   #5
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Original Poster
Rep: Reputation: 37
Tinkster, pixellany,servat78, thanks for your time in replying to my question. Thanks a lot
Old 02-22-2009, 06:26 PM   #6
Registered: Feb 2007
Location: TX, USA
Distribution: fedora
Posts: 191

Rep: Reputation: 33
Thumbs up Thanks

Thanks, i too got to know.


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
Difference Between Soft Link & Hard Link rajaniyer123 Solaris / OpenSolaris 16 09-30-2012 03:42 AM
hard link question - please explain it Thaidog Linux - General 3 10-02-2008 07:09 AM
hard link and soft link varunrapelly Linux - Newbie 9 10-02-2008 07:05 AM
question about hard link polarbear616 Linux - General 4 12-01-2006 08:58 AM
Problem related symbolic link raj_sony2001 Linux - General 1 06-01-2006 05:17 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 PM.

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