<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Create a hard link in UNIX</title>
	<atom:link href="http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/</link>
	<description>Computer and technology tutorials and guides</description>
	<lastBuildDate>Sat, 21 Nov 2009 22:16:28 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: karelc</title>
		<link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/comment-page-1/#comment-4730</link>
		<dc:creator>karelc</dc:creator>
		<pubDate>Sat, 01 Nov 2008 14:24:15 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-4730</guid>
		<description>Removing the original file will not destroy the linked file, and therefore the information is not lost. The contents only disappear when all links have been removed</description>
		<content:encoded><![CDATA[<p>Removing the original file will not destroy the linked file, and therefore the information is not lost. The contents only disappear when all links have been removed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: </title>
		<link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/comment-page-1/#comment-1488</link>
		<dc:creator></dc:creator>
		<pubDate>Thu, 24 Mar 2005 12:39:20 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-1488</guid>
		<description>I have a hard link in Windows Explorer on XP home edition.  How do I delete it?  (In laymen&#039;s terms)</description>
		<content:encoded><![CDATA[<p>I have a hard link in Windows Explorer on XP home edition.  How do I delete it?  (In laymen&#8217;s terms)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: </title>
		<link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/comment-page-1/#comment-144</link>
		<dc:creator></dc:creator>
		<pubDate>Sat, 17 Apr 2004 19:05:19 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-144</guid>
		<description>There is another very cool usage of this found at this place : http://bulma.net/body.phtml?nIdNoticia=2012 . Actually some programs create a different inode from a hardlinked file if you modify the file; for example patch, or vi (if you had previously &quot;set bkc=no&quot;) create a new inode when working on these hardlinks. 
So imagine you are compiling a kernel, trying different patchsets. You dont want to make many &quot;real&quot; copies of the same files, as it takes lot of space and time to do so. Then you could just do hardlinks to the files. And then, only the modified files will actually exist:

cd /usr/src/
cp -rl linux-clean linux-experiment

then you will see, the new folder takes lot less space than the original one but is however fully funcional :) you can compile, apply patches, etc....</description>
		<content:encoded><![CDATA[<p>There is another very cool usage of this found at this place : <a href="http://bulma.net/body.phtml?nIdNoticia=2012" rel="nofollow">http://bulma.net/body.phtml?nIdNoticia=2012</a> . Actually some programs create a different inode from a hardlinked file if you modify the file; for example patch, or vi (if you had previously &#8220;set bkc=no&#8221;) create a new inode when working on these hardlinks.<br />
So imagine you are compiling a kernel, trying different patchsets. You dont want to make many &#8220;real&#8221; copies of the same files, as it takes lot of space and time to do so. Then you could just do hardlinks to the files. And then, only the modified files will actually exist:</p>
<p>cd /usr/src/<br />
cp -rl linux-clean linux-experiment</p>
<p>then you will see, the new folder takes lot less space than the original one but is however fully funcional :) you can compile, apply patches, etc&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bofh468</title>
		<link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/comment-page-1/#comment-31</link>
		<dc:creator>bofh468</dc:creator>
		<pubDate>Fri, 14 Nov 2003 00:27:17 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-31</guid>
		<description>Probably a better way of describing the difference between hard and soft links:

The UNIX file system stores files in inodes.  The filesystem table contains a list of filenames, and the pointer to the inode in which that file exists.

A hard link creates a second entry in the filesystem table pointing to the same inode of the file.  This can be illustrated with the &lt;em&gt;ls&lt;/em&gt; command very easily:


&lt;code&gt;
1&#58; # touch /this
2&#58; # ln /this /root/that
3&#58; # ls -i /this /root/that
4&#58;      18 /root/that       18 /this
5&#58; # rm -f /this
6&#58; # ls -i /root/that
7&#58;      18 /root/that
&lt;/code&gt;


What did I do above?  Here&#039;s a play-by-play:

1: create a file (/this)
2: hardlink the file (/this) to another file (/root/that)
3: ask to see the inodes that the files exist in
4: note that the inode numbers are identical - 18
5: delete the original file
6: show me the inode of the other file again
7: it&#039;s still the same.

In the above example, Inode 18 is occupied only once, and is referenced by two different path/filenames.  Removing the first file doesn&#039;t in any way affect the second.  The actual inode is still in use by the second reference.  As soon as you remove all references, the inode is considered unused and can have new data written to it.

One caveat - hard links cannot span mount points.  My own home directory is mounted from another disk, for example, so I cannot hardlink from /this to /home/bofh/that.  The other caveat is that you cannot hard link directories.

Soft links are really pointers to a pointer.  &lt;em&gt;ls -i&lt;/em&gt; on both files will still show they are pointing at the same inode...  but if you remove the original file, then the inode is actually completely dereferenced.  The plus-side is that soft links can span mount points and you can soft link directories.  The downside is that if you remove the original then the link is broken.</description>
		<content:encoded><![CDATA[<p>Probably a better way of describing the difference between hard and soft links:</p>
<p>The UNIX file system stores files in inodes.  The filesystem table contains a list of filenames, and the pointer to the inode in which that file exists.</p>
<p>A hard link creates a second entry in the filesystem table pointing to the same inode of the file.  This can be illustrated with the <em>ls</em> command very easily:</p>
<p><code><br />
1&#58; # touch /this<br />
2&#58; # ln /this /root/that<br />
3&#58; # ls -i /this /root/that<br />
4&#58;      18 /root/that       18 /this<br />
5&#58; # rm -f /this<br />
6&#58; # ls -i /root/that<br />
7&#58;      18 /root/that<br />
</code></p>
<p>What did I do above?  Here&#8217;s a play-by-play:</p>
<p>1: create a file (/this)<br />
2: hardlink the file (/this) to another file (/root/that)<br />
3: ask to see the inodes that the files exist in<br />
4: note that the inode numbers are identical &#8211; 18<br />
5: delete the original file<br />
6: show me the inode of the other file again<br />
7: it&#8217;s still the same.</p>
<p>In the above example, Inode 18 is occupied only once, and is referenced by two different path/filenames.  Removing the first file doesn&#8217;t in any way affect the second.  The actual inode is still in use by the second reference.  As soon as you remove all references, the inode is considered unused and can have new data written to it.</p>
<p>One caveat &#8211; hard links cannot span mount points.  My own home directory is mounted from another disk, for example, so I cannot hardlink from /this to /home/bofh/that.  The other caveat is that you cannot hard link directories.</p>
<p>Soft links are really pointers to a pointer.  <em>ls -i</em> on both files will still show they are pointing at the same inode&#8230;  but if you remove the original file, then the inode is actually completely dereferenced.  The plus-side is that soft links can span mount points and you can soft link directories.  The downside is that if you remove the original then the link is broken.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
