我有rsync和–link-dest的磁盘使用问题
增量备份占用了完整的磁盘空间:
增量备份占用了完整的磁盘空间:
@localhost media]$ls orig ---------------------------------------------------- localhost media]$du -sh . 25M . ---------------------------------------------------- localhost media]$rsync -avh orig/ full ---------------------------------------------------- @localhost media]$du -sh . 49M . ---------------------------------------------------- localhost media]$echo 1111 > orig/foo111 ---------------------------------------------------- localhost media]$rsync -avh --link-dest=full orig/ orig_1 ---------------------------------------------------- localhost media]$ls orig_1/foo111 orig_1/foo111 _____________________________________________________ localhost media]$ls full/foo111 ls: cannot access full/foo111: No such file or directory
到目前为止一切看起来都很好.最新的变化反映在orig_1中
但这些目录没有硬连接,而且它们都是全尺寸的.
----------------------------------------------------- localhost media]$du -sh . 74M . --------------------------------------------- localhost media]$du -sh orig_1/ 25M orig_1/ -------------------------------------------- localhost media]$du -sh orig 25M orig --------------------------------------------- localhost media]$du -sh full 25M full
解决方法
当您运行rsync -avh –link-dest = full orig / orig_1时,您忽略了此错误消息(如果删除-v则更明显):
--link-dest arg does not exist: full
如果我们再看看–link-dest下的man rsync,我们会发现:
If DIR is a relative path,it is relative to the destination directory.
它就是. full是相对于当前目录的.相对于目标目录,它将是../full.
如果您再次尝试使用rsync -avh –link-dest = .. / full orig / orig_1,您将得到您所期望的:
$du -sh * 149M full 149M orig 232K orig_1 $du -sh . 298M .
请注意,单独计数时,目录仍会占用整个空间:
$du -sh orig_1 149M orig_1
这是因为du会跟踪已经看过的文件,并避免将它们计算两次.