xfs_copy
Copy XFS files between XFS filesystems
SYNOPSIS
xfs_copy [-d] [-s] [-v] [-L logfile] [-x filelist] source_file target_file
PARAMETERS
-d
Create the destination file/directory as hardlinked if the source and destination locations are on the same filesystem and other hardlink requirements are met.
-s
Enable sparse copy to the destination when the source is sparse.
-v
Be verbose during operation.
-L logfile
Write the copy log to the specified file. If this option is not specified, the log is written to standard output.
-x filelist
Exclude the files listed in the specified file.
source_file
The file or directory to copy.
target_file
The destination file or directory.
DESCRIPTION
The xfs_copy command is a utility designed to efficiently copy files between XFS filesystems.
It leverages the XFS filesystem's internal data structures to perform the copy operation directly at the metadata level whenever possible, without reading or writing the file data itself.
This method, called 'metadata copy', is significantly faster than traditional file copying techniques like `cp` which require reading and writing all file content.
The command can be used to copy single files or entire directory trees. When metadata copy is not possible (e.g., copying to a non-XFS filesystem or to a different XFS filesystem with incompatible features), xfs_copy falls back to a traditional file copy mechanism. It's important to note that `xfs_copy` operates on files within XFS filesystems and isn't designed for general file copying across different filesystem types unless in fallback mode. This tool is primarily useful for operations such as backing up files or restructuring data within XFS-formatted storage.
CAVEATS
xfs_copy performs metadata copies whenever possible. If metadata copying isn't supported (e.g., copying to a non-XFS filesystem, incompatible features), it reverts to a standard file copy, which is slower. Permissions and ownerships are preserved.
Special files like device nodes and named pipes are not supported and will result in a regular file being created at the destination.
RETURN VALUES
xfs_copy returns 0 if the copy completes without errors, 1 if any error occurs during copy.
PERMISSIONS
When possible (metadata copies), destination file/directory permissions will be the same as source files.
HISTORY
The `xfs_copy` command was created as part of the XFS filesystem utilities to provide an optimized method for copying files and directories within XFS. Its development focused on leveraging XFS-specific metadata capabilities for performance improvements. Usage became more prevalent in scenarios where fast backups or data restructuring within XFS volumes were required, reducing the time and resources needed compared to traditional copy methods.
SEE ALSO
cp(1), xfs(5), xfsdump(8), xfsrestore(8)