LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-25-2009, 12:09 PM   #1
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
Question related to hard link.


Friends,
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"
Thanks.
 
Old 01-25-2009, 12:16 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
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.



Cheers,
Tink
 
Old 01-25-2009, 12:21 PM   #3
pixellany
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."

Quote:
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, 08:19 PM   #4
servat78
Member
 
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.

Debian

Last edited by servat78; 02-19-2009 at 12:15 PM.
 
Old 01-25-2009, 11:29 PM   #5
saagar
Member
 
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, 07:26 PM   #6
palisetty_suman
Member
 
Registered: Feb 2007
Location: TX, USA
Distribution: fedora
Posts: 191

Rep: Reputation: 33
Thumbs up Thanks

Thanks, i too got to know.
 
  


Reply


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 04:42 AM
hard link question - please explain it Thaidog Linux - General 3 10-02-2008 08:09 AM
hard link and soft link varunrapelly Linux - Newbie 9 10-02-2008 08:05 AM
question about hard link polarbear616 Linux - General 4 12-01-2006 09:58 AM
Problem related symbolic link raj_sony2001 Linux - General 1 06-01-2006 06:17 AM


All times are GMT -5. The time now is 08:31 PM.

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