cloning a drive [was: war story]

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Jul 27 15:48:08 UTC 2011


On Wed, Jul 27, 2011 at 11:39:33AM -0400, James Knott wrote:
> How does that differ from using symbolic links?  IIRC, hard links do
> not work between partitions.

If you symlink, then deleting the original breaks the link.  If you
hardlink it always stays working.  The file only really is deleted when
all links to the file are removed.  All files have at least one hardlink
to them at all times, unless you delete the file.  That's why the link
count ls -l shows is always at least 1 for all files.

hardlinks can have different permissions on each link to the file,
symlinks don't.

But yes hardlinks don't work across partitions.  Nothing wrong with that.

For example:
-rwxr-xr-x 3 root root  35460 Oct  5  2010 bunzip2
-rwxr-xr-x 3 root root  35460 Oct  5  2010 bzcat
-rwxr-xr-x 3 root root  35460 Oct  5  2010 bzip2

Those are hardlinks to the same file with three names.  None of them
are the original file, unlike with symlinks where you need one real file
to symlink to.  All files are hardlinks, some just happen to share and
inode between them.  So hardlinks can't ever be obsolete since then
you would not have files at all.  The libc call for deleting a file is
'unlink' for a reason after all.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list