Open 6b6561 opened 6 years ago
"-H" should be added to $rsync_options to have any hard linked files synced as hard links and not as indivividual files.
-H, --hard-links preserve hard links
As an example, the bzcat files in the source are all hard linked files with the same inode, while the destination has these as three separate files.
Source root@hall2:/mnt/clone/bin# cd /bin root@hall2:/bin# ls -li bunzip2 bzcat bzip2 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bunzip2 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzcat 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzip2 root@hall2:/bin#
root@hall2:/mnt/clone/bin# cd /bin root@hall2:/bin# ls -li bunzip2 bzcat bzip2 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bunzip2 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzcat 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzip2 root@hall2:/bin#
Clone root@hall2:/tmp# cd /mnt/clone/bin/ root@hall2:/mnt/clone/bin# ls -li bunzip2 bzcat bzip2 475 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bunzip2 493 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bzcat 508 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bzip2 root@hall2:/mnt/clone/bin#
root@hall2:/tmp# cd /mnt/clone/bin/ root@hall2:/mnt/clone/bin# ls -li bunzip2 bzcat bzip2 475 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bunzip2 493 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bzcat 508 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bzip2 root@hall2:/mnt/clone/bin#
The good news is that adding -H to the rsync flags will correct the clone on the next run.
Clone after re-running rpi-clone with -H added to rsync flags root@hall2:/mnt/clone/bin# ls -li bunzip2 bzcat bzip2 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bunzip2 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzcat 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzip2 root@hall2:/mnt/clone/bin#
root@hall2:/mnt/clone/bin# ls -li bunzip2 bzcat bzip2 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bunzip2 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzcat 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzip2 root@hall2:/mnt/clone/bin#
"-H" should be added to $rsync_options to have any hard linked files synced as hard links and not as indivividual files.
As an example, the bzcat files in the source are all hard linked files with the same inode, while the destination has these as three separate files.
Source
root@hall2:/mnt/clone/bin# cd /bin root@hall2:/bin# ls -li bunzip2 bzcat bzip2 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bunzip2 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzcat 998 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzip2 root@hall2:/bin#
Clone
root@hall2:/tmp# cd /mnt/clone/bin/ root@hall2:/mnt/clone/bin# ls -li bunzip2 bzcat bzip2 475 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bunzip2 493 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bzcat 508 -rwxr-xr-x 1 root root 30404 Jan 29 2017 bzip2 root@hall2:/mnt/clone/bin#
The good news is that adding -H to the rsync flags will correct the clone on the next run.
Clone after re-running rpi-clone with -H added to rsync flags
root@hall2:/mnt/clone/bin# ls -li bunzip2 bzcat bzip2 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bunzip2 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzcat 475 -rwxr-xr-x 3 root root 30404 Jan 29 2017 bzip2 root@hall2:/mnt/clone/bin#