Any efficient way to copy/move huge file/fold from one subvol to another?

Under my btrfs filesystem, I have two subvols:


I want to move subvol34/hugedir1/hugefile1 to subvol35/hugedir1/hugefile1
(or the whole folder hugedir1, if possible)

Is there a way to do it in an efficient way?

btrfs filesystem sync isn’t this what you are looking for?

1 Like

I don’t think so. The only thing I see like that in the btrfs wiki is for copying a large file within a subvolume.

1 Like

“sync” seems about forcing pending writes to commit to disk.


  • Use the mv command.

  • The move shouldn’t cross a mount point.

  • The src/ and dest/ can’t mix datacow and nodatacow.


mv subvol34/hugedir1/hugefile1 subvol35/hugedir1/

The example implies the pwd is one that is in common for the two subvolumes. But you can also use full paths for src/ dest/

mv tries to use rename() first, but this fails because subvolumes are seperate namespaces with their own inode pool. Hence, hardlinks across subvolumes also isn’t possible. But mv falls back to cp --reflink=auto src/ dest/ and once complete, it removes src/.

There is a VFS rule that disallows efficient copies, if the copy crosses a mount point. Therefore if the mv doesn’t cross a mount point, cp --reflink=auto will be an efficient copy (reflink). If a mount point boundary is crossed, then the cp becomes a conventional/full file copy.


Thank you very much!

Yes, crossing mount point is the reason cp --reflink=always returned error for me.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.