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