大网数据广告活动
服务器运维问答

Rsync size is difference from source to destination

· 52CE 我爱测

I'm using rsync with the options -r for recursive -l copy symlinks as symlinks -t preserve modification time -D preserve devices and specials -v verbose --prune-empty-dirs The source FS is ext4 and the destination is XFS. I've co…

问题原文

原帖链接 · lbanz · CC BY-SA 3.0

I'm using rsync with the options

-r for recursive
-l copy symlinks as symlinks
-t preserve modification time
-D preserve devices and specials
-v verbose
--prune-empty-dirs

The source FS is ext4 and the destination is XFS. I've copied few hundred folders that range between few hundred gigs to few TB and they are all within within less than 1GB size difference. However This particular folder is 264GB on source and once I rsync it across it is 286GB. That is a huge difference and I don't know what is wrong with it.

If the source ext4 FS has some corruption, is it possible that it isn't reporting the correct disk usage? I'm using 'du -skh'.

I've deleted the whole thing and restarted it 3 times and it yields the same results.

社区高分解答

原帖链接 · TomOnTime · CC BY-SA 3.0

The most likely cause is hard links. Rsync by default turns 2 hardlinked files into duplicate files on the target taking up twice the disk space. If you want to preserve hard links add the -H/--hard-links option.

The next most likely issue is sparse files. Rsync by default does not write any files as sparse files even if they are on the source (it can't actually tell). If you have sparse files (most commonly used as virtual machine images and incomplete p2p downloads) then you will want to use the --sparse option.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-11-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。