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

Re: MBR partitioning, and content after partition table but before first partition



On 03/14/2017 03:34 AM, David wrote:
On 14 March 2017 at 14:36, David Christensen <dpchrist@holgerdanske.com> wrote:

Doing a quick test, it appears that rsync copies hard linked files as if
each were a different file:

rsync -a hard-link-1/ hard-link-2

Here, 'man rsync' says:
"Note that -a does not preserve hardlinks, because finding
multiply-linked files is expensive.  You must separately specify -H."

Thanks for the tip.  :-)


So, rsync can copy hard links:

2017-03-14 19:33:10 dpchrist@jesse ~/sandbox/rsync
$ cat hard-link
#!/bin/sh
# Test 'rsync -a' and hard links
# $Id: hard-link,v 1.3 2017/03/15 02:32:08 dpchrist Exp $
# by David Paul Christensen dpchrist@holgerdanske.com
# Public Domain
mkdir hard-link-1
mkdir hard-link-2
echo "hello, world!" > hard-link-1/hello.txt
ln hard-link-1/hello.txt hard-link-1/link-1.txt
ln hard-link-1/hello.txt hard-link-1/link-2.txt
ln hard-link-1/hello.txt hard-link-1/link-3.txt
ln hard-link-1/hello.txt hard-link-1/link-4.txt
ls -li hard-link-1/*
du -b hard-link-1/*
rsync -a -H hard-link-1/ hard-link-2
ls -li hard-link-2/*
du -b hard-link-2/*
rm -rf hard-link-1
rm -rf hard-link-2


2017-03-14 19:33:13 dpchrist@jesse ~/sandbox/rsync
$ sh hard-link
272911 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-1/hello.txt
272911 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-1/link-1.txt
272911 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-1/link-2.txt
272911 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-1/link-3.txt
272911 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-1/link-4.txt
14	hard-link-1/hello.txt
272912 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-2/hello.txt
272912 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-2/link-1.txt
272912 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-2/link-2.txt
272912 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-2/link-3.txt
272912 -rw-r--r-- 5 dpchrist dpchrist 14 Mar 14 19:33 hard-link-2/link-4.txt
14	hard-link-2/hello.txt


On 03/14/2017 04:52 AM, The Wanderer wrote:
> (You may want to check whether the resulting files are hardlinked back
> to the ones in the original tree; I haven't tested, and from reading the
> man page it doesn't seem entirely clear.)


The test above indicates that hard links created by rsync with the -H option point to files within the destination tree.


David


Reply to: