How would I make dir2 a copy of dir1 w/hardlinks for the files?

Kevin Korb kmk at sanitarium.net
Thu Mar 27 08:03:07 MDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You asked about copying dir1 to dir2 using hardlinks instead of actual
files.  That would mean that dir1 exists.  Maybe we are talking
backwards?  The dir listed on the command line twice is the one that
exists and the the one listed once is the one you are creating.

On 03/27/2014 05:34 AM, Linda A. Walsh wrote:
> Kevin Korb wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>> 
>> The rsync equivalent to cp -al would be: rsync -a
>> --link-dest=/path/to/dir1 /path/to/dir1/ /path/to/dir2/
>> 
>> Note that I switched to absolute paths since rsync considers -
>> --link-dest relative paths to be relative to the target so the 
>> relative example would be: rsync -a --link-dest=../dir1 dir1/
>> dir2/ which I think is stupid.
>> 
> Well, stupid syntax or not, if it works, it will still be better
> than the current state of cp which the devs are leaning toward not
> doing anything about -- they say it's the kernel's fault and they
> don't want to work around it on linux if it is the kernel's fault.
> Specifically, they rely on being able to hard link to everything
> that not a directory -- symlinks, sockets, pipes, -- if you can't 
> hard link it, they don't want to support it.
> 
> They think it would be silly to work around a linux kernel bug (or 
> feature some might say) by creating a user symlink w/the same
> contents as the root-owned symlink. the problems are related to the
> relatively new /proc/sys/fs/protected_{hard,soft}links settings
> which seem to be on by default.
> 
> While you can do some weird things with hard lines -- the claims
> of problems or exploits around symlinks seem to be blown out of
> proportion -- the coredev devel's don't believe it is exploitable,
> but that's really an aside. What is so, is that they don't want to
> spend time working on it -- even though they claim that the code to
> do make copies is tehre on other ports to systems where hard links 
> don't work.
> 
> For some reason they don't see linux no longer supporting hard
> links to things in various situation being the same as an OS that
> doesn't support them in the first place.  My comment was if they
> don't work, it should link what it can and make copies of the rest
> -- like they do dirs. Oh well.. thanks for the heads up -- tried
> link-dest, but not using the parent dir -- I just gave it dir1,
> which didn't exist yet, and it complained about that and wouldn't 
> start the copy.
> 
> 
> 

- -- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			http://www.sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlM0L5oACgkQVKC1jlbQAQcvawCglcvOfBHracRz4OM/dkLJQHay
dtEAoKz0tikcwioyk+NuAH5sdNf0s6eG
=22Td
-----END PGP SIGNATURE-----


More information about the rsync mailing list