I have a VM with two XFS file systems on two separate virtual disks.
The first XFS is 2.5 TB big and the second one is 1.5 TB big.
The first XFS uses 844 GB storage reported by df -h, but in reality 7.3 TB:
]# df -h
/dev/sdb1 2.5T 844G 1.7T 34% /a
]# du -sh /a
7.3T /a
The second XFS is empty and ready:
]# df -h
/dev/sdc1 1.5T 1.5T 20K 100% /b
The reason why I have to copy the data from /a to /b is because I have to shrink the disk. Since XFS does not support shrinking, I guess I have to do this method. (is there a better one?)
So I tried copying the data pretty dumb first by just using cp /a/. /b/ - but then the data grows and the real 7.3 TB appear. Which does not work, since /b is only 1.5 TB big.
After that I tried researching how to do this and I found this command:
xfsdump -l0 -J - /a | xfsrestore -J - /b
However, that command also does not work. Errors with No space left on device.
Does anyone have an idea how I could achieve this?
xfsdumpdoesn't support reflink, neither doesrsyncandcponly does it for new copies, not for transferring existing reflink structures over. There isduperemovewhich generates reflink for existing files but the catch is, the file has to exist in the filesystem first so the filesystem needs space to store. So it might be possible to find a solution step by step with that but it will involve some juggling and depend on your file structure.