How to move directories that have files in common from one to another partition ?
Let's assume we have partition mounted on /mnt/X
with directories sharing files with hardlinks.
How to move such directories to another partition , let it be /mnt/Y
with preserving those hardlinks.
For better illustration what do I mean by "directories sharing files in common with hardlinks", here is an example:
# let's create three of directories and files
mkdir -p a/{b,c,d}/{x,y,z}
touch a/{b,c,d}/{x,y,z}/f{1,2,3,4,5}
# and copy it with hardlinks
cp -r -l a hardlinks_of_a
To be more specific, let's assume that total size of files is 10G and each file has 10 hardlinks. The question is how to move it to destination with using 10G (someone might say about copying it with 100G and then running deduplication - it is not what I am asking about)