Re: need help making hard link for a directory tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 14 Feb 2005 08:14:59 -0600, fedora-list@xxxxxxxxxxxxxx
<fedora-list@xxxxxxxxxxxxxx> wrote:
> I need to mirror a complex directory structure with hard links. Of course the
> directories themselves can not be hard linked,


Actually, you *can* hard-link directories (if root).  But it's just
not advisable
unless you are an *expert*.  Hard linked directories can cause all kinds of
strangeness, and potentially corrupted filesystems.  In addition the meaning
of "." and ".." may be surprising to you, or to some software.  [in fact the
"." and ".." directories are in fact just hard links to the real
directory, which the
kernel creates for you automatically.]

See the man page for ln(1), and for link(2).


> but is there a simple way to
> create a duplicate directory tree and then make hard links to all of the
> files?

Many options...

The -l option on the cp(1) command.

Use a gtar-pair with the -H option, like,

   gtar -C srcdir -cHf - . | gtar -C destdir -xHpf -

Use rsync, like,

   rsync -av /srcdir /destdir

   (It's really the -l option on rsync, but the -a implies -l)

Or, if you want symlinks instead of hardlinks, see the
lndir(1) command.

 
> The links are to provide ftp access to files in a chrooted area on the same
> partition.

Then another option, is to use loopback mounts.  That has the advantage in
that files can be added/removed without having to redo link maintenance.

-- 
Deron Meranda


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux