I have two articles described how to backup and restore a XFS filesystem, one is using xfsdump and xfsrestore, the other one is xfs_copy
Both xfs_copy and xfsdump can be used for xfs backup, the question is are they same? What's different?
Here are few obvious differences in quick summary:
XFS backup mode
xfs_copy just simply copy the whole files system.
While xfsdump options allow the operator to have all files dumped, just files that have changed since a previous dump, or just files contained in a list of pathnames. xfsdump backs up files and their attributes in a files ystem.The files are dumped to storage media, a regular file, or standard output.
XFS source file system status
xfs_copy should only be used to copy unmounted filesystems, read-only mounted filesystems, or frozen filesystems. Otherwise, the generated filesystem(s) would be inconsistent or corrupt.
xfsdump is used to create a backup for online XFS file system
Both xfs_copy and xfsdump do not alter the source file system in any way.
Target XFS file system size/space cost
If the target 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.
While xfsdump creates a dump file(s) that just contain files.
Target file/image
The target of xfs_copy can be either device or a regular file, in which case an image of the source XFS filesystem is created in that file. Both device/image can be mounted directly.
While xfsdump target are dump format, has to be restored by xfsrestore.
Multiple targets in parallel
xfs_copy copies an XFS filesystem to one or more targets in parallel. 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.
While xfsdump does support multiple targets. However, xfsdump splits the whole backup into multiple media devices.
Copy streams and blocksize
xfs_copy uses synchronous writes to ensure that write errors are detected. xfs_copy uses pthreads(7) to perform simultaneous parallel writes. xfs_copy creates one additional thread for each target to be written. All threads die if xfs_copy terminates or aborts.
xfsdump also use multiple
Target file system identifier(UUID)
Not like dd or other programs that do block by block disk copying. xfs_copy or xfsdump generate the new file system(s) instead of dd(1) or other programs that do block-by-block disk copying. Each new (target) file system is identical to the original file system except that new file systems each have a new unique file system identifier (UUID). Therefore, if both the old and new file systems will be used as separate distinct file systems,
XFS file system migration considerations
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) and xfsdump(8)/xfsrestore(8) be used instead of using xfs_copy and xfs_growfs(8). The filesystem layout resulting from using xfs_copy/xfs_growfs is almost always worse than the result of using 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) works, and not due to any shortcoming in xfs_copy itself.
Comments powered by CComment