深度阅读

How to use rsync with hard link preservation to save disk space?

作者
作者
2023年08月22日
更新时间
8.56 分钟
阅读时间
0
阅读量

To use rsync with hard link preservation to save disk space, you can use the -H or --hard-links option to preserve hard links when copying files between directories. This will ensure that only one copy of the data is stored on disk, even if it appears in multiple directories.

Here is an example command to copy a directory with hard links preserved using rsync:

rsync -avzH /path/to/source/ /path/to/destination/

Explanation of the options used:

  • -a: archive mode, which preserves permissions, ownership, timestamps, and recursive copying
  • -v: verbose output
  • -z: compress file data during transfer to reduce bandwidth usage
  • -H: preserve hard links during transfer

Note that you should specify the trailing slash on the source and destination directories to ensure that the entire directory structure is preserved.

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。