NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
BUGS
SEE ALSO

NAME

xfs_copy - copy the contents of an XFS filesystem

SYNOPSIS

xfs_copy [ -d ] device|file device1 [ device2 device3 ... ]
xfs_copy [ -d ] device|file file1

DESCRIPTION

xfs_copy copies an XFS filesystem to one or more targets in parallel (see xfs(4)). 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 a filename. If the pathnames specify devices, a copy of the source XFS filesystem is cre- ated on each device. If any of the source or target device names specify devices that are not raw devices, xfs_copy attempts to locate the raw device corresponding to the specified device and use the raw device instead.

If there is only one target, that target can 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 can only be used to copy unmounted filesystems. Otherwise, the generated filesystem(s) would be inconsistent or corrupt. Some versions of xfs_copy may print a message that they have detected a mounted filesystem, but are continuing the attempt to copy, and then issue a message that they are aborting. This is mis- leading, but not incorrect. Unmount the filesystem and then issue the command. This means that if you want to copy the root (/) filesystem, you must first load the miniroot, then unmount the root with the inst command admin umount /root and then do the copy.

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/xfsrestore should be used to generate the new filesystem(s) instead of dd(1M) or other programs that do block-by-block disk copy- ing.

The -d (duplicate) option can be used if a true clone is desired. This should be done only if the new filesystem will be used as a replacement for the original filesystem (such as in the case of disk replacement).

xfs_copy uses synchronous writes to ensure that write errors are detected. xfs_copy also uses sprocs (see sproc(2)) to perform simultaneous parallel writes. Therefore, ps(1) reports multiple copies of xfs_copy while the copy is in progress. xfs_copy creates one additional sproc for each target to be written. All sprocs die if xfs_copy terminates or aborts.

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.

DIAGNOSTICS

xfs_copy reports errors to both stderr and in more detailed form to a generated log file whose name is of the form /usr/tmp/xfs_copy.log.??????. 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 logfile, but the rest of the copies continue. When xfs_copy terminates, all aborted targets are reported to both stderr and the logfile. In some cases, xfs_copy may report the message xfs_copy: couldn't initialize simulation library following another error message. This message is some- times of use when debugging problems, and should normally be ignored.

If all targets abort or if there is an error reading the source filesystem, xfs_copy immediately 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.

BUGS

When moving filesystems from one disk to another, if the original filesystem is less than 4 Gbytes long and the new filesystem will larger, we recommend that mkfs and xfsdump/xfsrestore be used instead of using xfs_copy and xfs_growfs. The filesystem layout resulting from using xfs_copy/xfs_growfs is almost always worse than the result of using mkfs/xfsdump/xfsrestore but in the case of small filesystems, the differences can have a significant performance impact.

xfs_copy does not copy XFS filesystems with real-time partitions or external logs.

If the source filesystem is bigger than the target partition, the copy may succeed if the blocks at the end of the source filesystem are not in use but the generated copy will not be a valid filesystem.

SEE ALSO

mkfs_xfs(1M), xfsdump(1M), xfsrestore(1M), xfs(4), xlv(7M).