How to copy files with preserving reflinks ?

Prasanna Kumar Kalever pkalever at redhat.com
Fri Feb 26 00:37:57 CST 2016


Hi,

I have a VM file with reflinks to it, the reflinks were taken every night.

My question is how to copy/migrate all these file to a different xfs partition (which also have reflink enabled) without loosing the reflinks property, else may lead to copy all the shared blocks per file which will cost large disk space.

I have tried to copy them using rsync as below:

On Partition 1:

ActualFile.img -- [1] Actaul Size 10GB + [2] Append 2GB + [3] Append 1GB
ReflinkCopy1   -- [1] Actual Size  0  -- Shared blocks 10GB
ReflinkCopy2   -- [2] Actual Size  0  -- Shared blocks 12GB


I have first rsync the files into Partition 2 as below:

# cd PARTITION2

# rsync /PARTITION1/ReflinkCopy1 ActualFile.img
# du -sh ActualFile.img
10GB
# cp --reflink=always ActualFile.img

# rsync /PARTITION1/ReflinkCopy2 ActualFile.img
# du -sh ActualFile.img
12GB
# cp --reflink=always ActualFile.img

# rsync  /PARTITION1/ActualFile.img ActualFile.img

But the size used by partition was 35GB (verified using df -h) instead of 13GB 



Also, where can I find reflink related tools ?


Thanks,
-Prasanna ​ 




More information about the xfs mailing list