1xfs_copy(8) System Manager's Manual xfs_copy(8)
2
3
4
6 xfs_copy - copy the contents of an XFS filesystem
7
9 xfs_copy [ -bd ] [ -L log ] source target1 [ target2 ... ]
10 xfs_copy -V
11
13 xfs_copy copies an XFS filesystem to one or more targets in parallel
14 (see xfs(5)). The first (source) argument must be the pathname of the
15 device or file containing the XFS filesystem. The remaining arguments
16 specify one or more target devices or file names. If the pathnames
17 specify devices, a copy of the source XFS filesystem is created on each
18 device. The target can also be the name of a regular file, in which
19 case an image of the source XFS filesystem is created in that file. If
20 the file does not exist, xfs_copy creates the file. The length of the
21 resulting file is equal to the size of the source filesystem. However,
22 if the file is created on an XFS filesystem, the file consumes roughly
23 the amount of space actually used in the source filesystem by the
24 filesystem and the XFS log. The space saving is because xfs_copy seeks
25 over free blocks instead of copying them and the XFS filesystem sup‐
26 ports sparse files efficiently.
27
28 xfs_copy should only be used to copy unmounted filesystems, read-only
29 mounted filesystems, or frozen filesystems (see xfs_freeze(8)). Other‐
30 wise, the generated filesystem(s) would be inconsistent or corrupt.
31
32 xfs_copy does not alter the source filesystem in any way. Each new
33 (target) filesystem is identical to the original filesystem except that
34 new filesystems each have a new unique filesystem identifier (UUID).
35 Therefore, if both the old and new filesystems will be used as separate
36 distinct filesystems, xfs_copy or xfsdump(8)/xfsrestore(8) should be
37 used to generate the new filesystem(s) instead of dd(1) or other pro‐
38 grams that do block-by-block disk copying.
39
40 xfs_copy uses synchronous writes to ensure that write errors are
41 detected.
42
43 xfs_copy uses pthreads(7) to perform simultaneous parallel writes.
44 xfs_copy creates one additional thread for each target to be written.
45 All threads die if xfs_copy terminates or aborts.
46
48 -d Create a duplicate (true clone) filesystem. This should be done
49 only if the new filesystem will be used as a replacement for the
50 original filesystem (such as in the case of disk replacement).
51
52 -b The buffered option can be used to ensure direct IO is not
53 attempted to any of the target files. This is useful when the
54 filesystem holding the target file does not support direct IO.
55
56 -L log Specifies the location of the log if the default location of
57 /var/tmp/xfs_copy.log.XXXXXX is not desired.
58
59 -V Prints the version number and exits.
60
62 xfs_copy reports errors to both stderr and in more detailed form to a
63 generated log file whose name is of the form
64 /var/tmp/xfs_copy.log.XXXXXX or a log file specified by the -L option.
65 If xfs_copy detects a write error on a target, the copy of that one
66 target is aborted and an error message is issued to both stderr and the
67 log file, but the rest of the copies continue. When xfs_copy termi‐
68 nates, all aborted targets are reported to both stderr and the log
69 file.
70
71 If all targets abort or if there is an error reading the source
72 filesystem, xfs_copy immediately aborts.
73
74 xfs_copy returns an exit code of 0 if all targets are successfully
75 copied and an exit code of 1 if any target fails.
76
78 When moving filesystems from one disk to another, if the original
79 filesystem is significantly smaller than the new filesystem, and will
80 be made larger, we recommend that mkfs.xfs(8) and xfsdump(8)/xfsre‐
81 store(8) be used instead of using xfs_copy and xfs_growfs(8). The
82 filesystem layout resulting from using xfs_copy/xfs_growfs is almost
83 always worse than the result of using mkfs.xfs/xfsdump/xfsrestore but
84 in the case of small filesystems, the differences can have a signifi‐
85 cant performance impact. This is due to the way xfs_growfs(8) works,
86 and not due to any shortcoming in xfs_copy itself.
87
89 xfs_copy does not copy XFS filesystems that have a real-time section or
90 XFS filesystems with external logs. In both cases, xfs_copy aborts with
91 an error message.
92
94 mkfs.xfs(8), xfsdump(8), xfsrestore(8), xfs_freeze(8), xfs_growfs(8),
95 xfs(5).
96
97
98
99 xfs_copy(8)