# man > xfs_copy(8)

[xfs_copy(8)](https://www.chedong.com/phpMan.php/man/xfscopy/8/markdown)                            System Manager's Manual                           [xfs_copy(8)](https://www.chedong.com/phpMan.php/man/xfscopy/8/markdown)



## NAME
       xfs_copy - copy the contents of an XFS filesystem

## SYNOPSIS
       **xfs**___**copy** [ **-bd** ] [ **-L** _log_ ] _source_ _target1_ [ _target2_ ... ]
       **xfs**___**copy** **-V**

## DESCRIPTION
       **xfs**___**copy** copies an XFS filesystem to one or more targets in parallel (see [**xfs**(5)](https://www.chedong.com/phpMan.php/man/xfs/5/markdown)).  The first
       (_source_) argument must be the pathname of the device or file containing the  XFS  filesystem.
       The  remaining  arguments  specify one or more _target_ devices or file names. If the pathnames
       specify devices, a copy of the source XFS filesystem is created on each  device.  The  _target_
       can  also  be the name of a regular file, in which case an image of the source XFS filesystem
       is created in that file. If the file does not exist, **xfs**___**copy** creates the file. The length of
       the  resulting  file  is  equal to the size of the source filesystem. However, if the file is
       created on an XFS filesystem, the file consumes roughly the amount of space actually used  in
       the  source  filesystem  by  the  filesystem  and  the  XFS log.  The space saving is because
       **xfs**___**copy** seeks over free blocks instead of copying  them  and  the  XFS  filesystem  supports
       sparse files efficiently.

       **xfs**___**copy** should only be used to copy unmounted filesystems, read-only mounted filesystems, or
       frozen filesystems (see **xfs**___**[freeze**(8)](https://www.chedong.com/phpMan.php/man/freeze/8/markdown)).  Otherwise, the generated filesystem(s) would be  in‐
       consistent or corrupt.

       **xfs**___**copy**  does  not  alter  the source filesystem in any way. Each new (target) filesystem is
       identical to the original filesystem except that new  filesystems  each  have  a  new  unique
       filesystem identifier (UUID).  Therefore, if both the old and new filesystems will be used as
       separate distinct filesystems, **xfs**___**copy** or [**xfsdump**(8)](https://www.chedong.com/phpMan.php/man/xfsdump/8/markdown)/[**xfsrestore**(8)](https://www.chedong.com/phpMan.php/man/xfsrestore/8/markdown) should be used to  gener‐
       ate  the  new  filesystem(s)  instead  of [**dd**(1)](https://www.chedong.com/phpMan.php/man/dd/1/markdown) or other programs that do block-by-block disk
       copying.

       **xfs**___**copy** uses synchronous writes to ensure that write errors are detected.

       **xfs**___**copy** uses [**pthreads**(7)](https://www.chedong.com/phpMan.php/man/pthreads/7/markdown) to perform simultaneous parallel writes.  **xfs**___**copy** creates one  ad‐
       ditional  thread  for  each  target to be written.  All threads die if **xfs**___**copy** terminates or
       aborts.

## OPTIONS
### -d
              filesystem  will  be used as a replacement for the original filesystem (such as in the
              case of disk replacement).

### -b
              target files. This is useful when the filesystem holding the target file does not sup‐
              port direct IO.

### -L
              _/var/tmp/xfs_copy.log.XXXXXX_ is not desired.

### -V

## DIAGNOSTICS
       **xfs**___**copy**  reports  errors  to  both  **stderr** and in more detailed form to a generated log file
       whose name is of the form _/var/tmp/xfs_copy.log.XXXXXX_ or a log file specified by the **-L**  op‐
       tion.  If  **xfs**___**copy** detects a write error on a target, the copy of that one target is aborted
       and an error message is issued to both stderr and the log file, but the rest  of  the  copies
       continue.  When  **xfs**___**copy** terminates, all aborted targets are reported to both **stderr** and the
       log file.

       If all targets abort or if there is an error reading the source filesystem, **xfs**___**copy**  immedi‐
       ately aborts.

       **xfs**___**copy** returns an exit code of 0 if all targets are successfully copied and an exit code of
       1 if any target fails.

## NOTES
       When moving filesystems from one disk to another, if the original filesystem is significantly
       smaller  than  the new filesystem, and will be made larger, we recommend that [**mkfs.xfs**(8)](https://www.chedong.com/phpMan.php/man/mkfs.xfs/8/markdown) and
       [**xfsdump**(8)](https://www.chedong.com/phpMan.php/man/xfsdump/8/markdown)/[**xfsrestore**(8)](https://www.chedong.com/phpMan.php/man/xfsrestore/8/markdown) be used instead of using **xfs**___**copy** and **xfs**___**[growfs**(8)](https://www.chedong.com/phpMan.php/man/growfs/8/markdown).  The filesystem
       layout resulting from using **xfs**___**copy**/**xfs**___**growfs** is almost always worse than the result of us‐
       ing **mkfs.xfs**/**xfsdump**/**xfsrestore** but in the case of small  filesystems,  the  differences  can
       have  a  significant  performance impact. This is due to the way **xfs**___**[growfs**(8)](https://www.chedong.com/phpMan.php/man/growfs/8/markdown) works, and not
       due to any shortcoming in **xfs**___**copy** itself.

## CAVEATS
       **xfs**___**copy** does not copy XFS filesystems that have a real-time section or XFS filesystems  with
       external logs. In both cases, **xfs**___**copy** aborts with an error message.

## SEE ALSO
       [**mkfs.xfs**(8)](https://www.chedong.com/phpMan.php/man/mkfs.xfs/8/markdown), [**xfsdump**(8)](https://www.chedong.com/phpMan.php/man/xfsdump/8/markdown), [**xfsrestore**(8)](https://www.chedong.com/phpMan.php/man/xfsrestore/8/markdown), **xfs**___**[freeze**(8)](https://www.chedong.com/phpMan.php/man/freeze/8/markdown), **xfs**___**[growfs**(8)](https://www.chedong.com/phpMan.php/man/growfs/8/markdown), [**xfs**(5)](https://www.chedong.com/phpMan.php/man/xfs/5/markdown).



                                                                                         [xfs_copy(8)](https://www.chedong.com/phpMan.php/man/xfscopy/8/markdown)
