{"id":162662,"date":"2019-11-27T08:14:52","date_gmt":"2019-11-27T00:14:52","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=162662"},"modified":"2019-10-29T09:16:55","modified_gmt":"2019-10-29T01:16:55","slug":"linux-rsync-file","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-rsync-file.html","title":{"rendered":"\u4eba\u4eec\u5bf9\u4e8e\u7528rsync\u590d\u5236\u5927\u6587\u4ef6\u7684\u4e00\u4e9b\u8bef\u89e3"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6709\u4e00\u79cd\u89c2\u70b9\u8ba4\u4e3a\uff0c\u5728 IT \u884c\u4e1a\u5de5\u4f5c\u7684\u8bb8\u591a\u4eba\u7ecf\u5e38\u4ece\u7f51\u7edc\u5e16\u5b50\u91cc\u590d\u5236\u548c\u7c98\u8d34\u3002\u6211\u4eec\u90fd\u5e72\u8fc7\uff0c\u590d\u5236\u7c98\u8d34\u672c\u8eab\u4e0d\u662f\u95ee\u9898\u3002\u95ee\u9898\u662f\u5f53\u6211\u4eec\u5728\u4e0d\u7406\u89e3\u5b83\u4eec\u7684\u60c5\u51b5\u4e0b\u8fd9\u6837\u5e72\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u51e0\u5e74\u524d\uff0c\u4e00\u4e2a\u66fe\u7ecf\u5728\u6211\u56e2\u961f\u4e2d\u5de5\u4f5c\u7684\u670b\u53cb\u9700\u8981\u5c06\u865a\u62df\u673a\u6a21\u677f\u4ece\u7ad9\u70b9 A \u590d\u5236\u5230\u7ad9\u70b9 B\u3002\u4ed6\u4eec\u65e0\u6cd5\u7406\u89e3\u4e3a\u4ec0\u4e48\u590d\u5236\u7684\u6587\u4ef6\u5728\u7ad9\u70b9 A \u4e0a\u4e3a 10GB\uff0c\u4f46\u662f\u5728\u7ad9\u70b9 B \u4e0a\u5374\u53d8\u4e3a 100GB\u3002<\/p>\n

\u8fd9\u4f4d\u670b\u53cb\u8ba4\u4e3a rsync \u662f\u4e00\u4e2a\u795e\u5947\u7684\u5de5\u5177\uff0c\u5e94\u8be5\u4ec5\u201c\u540c\u6b65\u201d\u6587\u4ef6\u672c\u8eab\u3002\u4f46\u662f\uff0c\u6211\u4eec\u5927\u591a\u6570\u4eba\u6240\u5fd8\u8bb0\u7684\u662f\u4e86\u89e3 rsync \u7684\u771f\u6b63\u542b\u4e49\u3001\u7528\u6cd5\uff0c\u4ee5\u53ca\u6211\u8ba4\u4e3a\u6700\u91cd\u8981\u7684\u662f\u5b83\u539f\u672c\u662f\u7528\u6765\u505a\u4ec0\u4e48\u7684\u3002\u672c\u6587\u63d0\u4f9b\u4e86\u6709\u5173 rsync \u7684\u66f4\u591a\u4fe1\u606f\uff0c\u5e76\u89e3\u91ca\u4e86\u90a3\u4ef6\u4e8b\u4e2d\u53d1\u751f\u4e86\u4ec0\u4e48\u3002<\/p>\n

\u5173\u4e8e rsync<\/strong><\/div>\n

rsync \u662f\u7531 Andrew Tridgell \u548c Paul Mackerras \u521b\u5efa\u7684\u5de5\u5177\uff0c\u5176\u52a8\u673a\u662f\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n

\u5047\u8bbe\u4f60\u6709\u4e24\u4e2a\u6587\u4ef6\uff0cfile_A \u548c file_B\u3002\u4f60\u5e0c\u671b\u5c06 file_B \u66f4\u65b0\u4e3a\u4e0e file_A \u76f8\u540c\u3002\u663e\u800c\u6613\u89c1\u7684\u65b9\u6cd5\u662f\u5c06 file_A \u590d\u5236\u5230 file_B\u3002<\/p>\n

\u73b0\u5728\uff0c\u5047\u8bbe\u8fd9\u4e24\u4e2a\u6587\u4ef6\u4f4d\u4e8e\u901a\u8fc7\u6162\u901f\u901a\u4fe1\u94fe\u63a5\uff08\u4f8b\u5982\uff0c\u62e8\u53f7 IP \u94fe\u63a5\uff09\u8fde\u63a5\u7684\u4e24\u4e2a\u4e0d\u540c\u7684\u670d\u52a1\u5668\u4e0a\u3002\u5982\u679cfile_A \u5927\uff0c\u5c06\u5176\u590d\u5236\u5230 file_B \u5c06\u4f1a\u5f88\u6162\uff0c\u6709\u65f6\u751a\u81f3\u662f\u4e0d\u53ef\u80fd\u5b8c\u6210\u7684\u3002\u4e3a\u4e86\u63d0\u9ad8\u6548\u7387\uff0c\u4f60\u53ef\u4ee5\u5728\u53d1\u9001\u524d\u538b\u7f29 file_A\uff0c\u4f46\u8fd9\u901a\u5e38\u53ea\u4f1a\u83b7\u5f97 2 \u5230 4 \u500d\u7684\u6548\u7387\u63d0\u5347\u3002<\/p>\n

\u73b0\u5728\u5047\u8bbe file_A \u548c file_B \u975e\u5e38\u76f8\u4f3c\uff0c\u5e76\u4e14\u4e3a\u4e86\u52a0\u5feb\u5904\u7406\u901f\u5ea6\uff0c\u4f60\u53ef\u4ee5\u5229\u7528\u8fd9\u79cd\u76f8\u4f3c\u6027\u3002\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4ec5\u901a\u8fc7\u94fe\u63a5\u53d1\u9001 file_A \u548c file_B \u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u7136\u540e\u4f7f\u7528\u8fd9\u4e2a\u5dee\u5f02\u5217\u8868\u5728\u8fdc\u7a0b\u7aef\u91cd\u5efa\u6587\u4ef6\u3002<\/p>\n

\u95ee\u9898\u5728\u4e8e\uff0c\u7528\u4e8e\u5728\u4e24\u4e2a\u6587\u4ef6\u4e4b\u95f4\u521b\u5efa\u4e00\u7ec4\u5dee\u5f02\u7684\u5e38\u89c4\u65b9\u6cd5\u4f9d\u8d56\u4e8e\u80fd\u591f\u8bfb\u53d6\u4e24\u4e2a\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u5b83\u4eec\u8981\u6c42\u94fe\u63a5\u7684\u4e00\u7aef\u9884\u5148\u63d0\u4f9b\u4e24\u4e2a\u6587\u4ef6\u3002\u5982\u679c\u5b83\u4eec\u5728\u540c\u4e00\u53f0\u8ba1\u7b97\u673a\u4e0a\u4e0d\u662f\u540c\u65f6\u53ef\u7528\u7684\uff0c\u5219\u65e0\u6cd5\u4f7f\u7528\u8fd9\u4e9b\u7b97\u6cd5\u3002\uff08\u4e00\u65e6\u5c06\u6587\u4ef6\u590d\u5236\u8fc7\u6765\uff0c\u5c31\u4e0d\u9700\u8981\u505a\u5bf9\u6bd4\u5dee\u5f02\u4e86\uff09\u3002\u800c\u8fd9\u662f rsync \u89e3\u51b3\u7684\u95ee\u9898\u3002<\/p>\n

rsync \u7b97\u6cd5\u6709\u6548\u5730\u8ba1\u7b97\u6e90\u6587\u4ef6\u7684\u54ea\u4e9b\u90e8\u5206\u4e0e\u73b0\u6709\u76ee\u6807\u6587\u4ef6\u7684\u90e8\u5206\u5339\u914d\u3002\u8fd9\u6837\uff0c\u5339\u914d\u7684\u90e8\u5206\u5c31\u4e0d\u9700\u8981\u901a\u8fc7\u94fe\u63a5\u53d1\u9001\u4e86\uff1b\u6240\u9700\u8981\u7684\u53ea\u662f\u5bf9\u76ee\u6807\u6587\u4ef6\u90e8\u5206\u7684\u5f15\u7528\u3002\u53ea\u6709\u6e90\u6587\u4ef6\u4e2d\u4e0d\u5339\u914d\u7684\u90e8\u5206\u624d\u9700\u8981\u53d1\u9001\u3002<\/p>\n

\u7136\u540e\uff0c\u63a5\u6536\u8005\u53ef\u4ee5\u4f7f\u7528\u5bf9\u73b0\u6709\u76ee\u6807\u6587\u4ef6\u5404\u4e2a\u90e8\u5206\u7684\u5f15\u7528\u548c\u539f\u59cb\u7d20\u6750\u6765\u6784\u9020\u6e90\u6587\u4ef6\u7684\u526f\u672c\u3002<\/p>\n

\u53e6\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u7cfb\u5217\u5e38\u7528\u538b\u7f29\u7b97\u6cd5\u4e2d\u7684\u4efb\u4f55\u4e00\u79cd\u6765\u538b\u7f29\u53d1\u9001\u5230\u63a5\u6536\u5668\u7684\u6570\u636e\uff0c\u4ee5\u8fdb\u4e00\u6b65\u63d0\u9ad8\u901f\u5ea6\u3002<\/p>\n

\u6211\u4eec\u90fd\u77e5\u9053\uff0crsync \u7b97\u6cd5\u4ee5\u4e00\u79cd\u6f02\u4eae\u7684\u65b9\u5f0f\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n

\u5728 rsync \u7684\u4ecb\u7ecd\u4e4b\u540e\uff0c\u56de\u5230\u90a3\u4ef6\u4e8b\uff01<\/p>\n

\u95ee\u9898 1\uff1a\u81ea\u52a8\u7cbe\u7b80\u914d\u7f6e<\/strong><\/div>\n

\u6709\u4e24\u4ef6\u4e8b\u53ef\u4ee5\u5e2e\u52a9\u90a3\u4e2a\u670b\u53cb\u4e86\u89e3\u6b63\u5728\u53d1\u751f\u7684\u4e8b\u60c5\u3002<\/p>\n

\u8be5\u6587\u4ef6\u5728\u5176\u4ed6\u5730\u65b9\u7684\u5927\u5c0f\u53d8\u5f97\u8d8a\u6765\u8d8a\u5927\u7684\u95ee\u9898\u662f\u7531\u6e90\u7cfb\u7edf\u4e0a\u542f\u7528\u4e86\u81ea\u52a8\u7cbe\u7b80\u914d\u7f6eThin Provisioning\uff08TP\uff09\u5f15\u8d77\u7684\uff0c\u8fd9\u662f\u4e00\u79cd\u4f18\u5316\u5b58\u50a8\u533a\u57df\u7f51\u7edc\uff08SAN\uff09\u6216\u7f51\u7edc\u8fde\u63a5\u5b58\u50a8\uff08NAS\uff09\u4e2d\u53ef\u7528\u7a7a\u95f4\u6548\u7387\u7684\u65b9\u6cd5\u3002<\/p>\n

\u7531\u4e8e\u542f\u7528\u4e86 TP\uff0c\u6e90\u6587\u4ef6\u53ea\u6709 10GB\uff0c\u5e76\u4e14\u5728\u4e0d\u4f7f\u7528\u4efb\u4f55\u5176\u4ed6\u914d\u7f6e\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528 rsync \u8fdb\u884c\u4f20\u8f93\u65f6\uff0c\u76ee\u6807\u4f4d\u7f6e\u5c06\u63a5\u6536\u5230\u5168\u90e8 100GB \u7684\u5927\u5c0f\u3002rsync \u65e0\u6cd5\u81ea\u52a8\u5b8c\u6210\u8be5\uff08TP\uff09\u64cd\u4f5c\uff0c\u5fc5\u987b\u5bf9\u5176\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n

\u8fdb\u884c\u6b64\u5de5\u4f5c\u7684\u9009\u9879\u662f -S\uff08\u6216 \u2013sparse\uff09\uff0c\u5b83\u544a\u8bc9 rsync \u6709\u6548\u5730\u5904\u7406\u7a00\u758f\u6587\u4ef6\u3002\u5b83\u4f1a\u6309\u7167\u5b83\u8bf4\u7684\u505a\uff01\u5b83\u53ea\u4f1a\u53d1\u9001\u8be5\u7a00\u758f\u6570\u636e\uff0c\u56e0\u6b64\u6e90\u548c\u76ee\u6807\u5c06\u6709\u4e00\u4e2a 10GB \u7684\u6587\u4ef6\u3002<\/p>\n

\u95ee\u9898 2\uff1a\u66f4\u65b0\u6587\u4ef6<\/strong><\/div>\n

\u5f53\u53d1\u9001\u4e00\u4e2a\u66f4\u65b0\u7684\u6587\u4ef6\u65f6\u4f1a\u51fa\u73b0\u7b2c\u4e8c\u4e2a\u95ee\u9898\u3002\u73b0\u5728\u76ee\u6807\u4ec5\u63a5\u6536 10GB \u4e86\uff0c\u4f46\u59cb\u7ec8\u4f20\u8f93\u7684\u662f\u6574\u4e2a\u6587\u4ef6\uff08\u5305\u542b\u865a\u62df\u78c1\u76d8\uff09\uff0c\u5373\u4f7f\u53ea\u662f\u5728\u8be5\u865a\u62df\u78c1\u76d8\u4e0a\u66f4\u6539\u4e86\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u53ea\u662f\u8be5\u6587\u4ef6\u7684\u4e00\u5c0f\u90e8\u5206\u53d1\u751f\u4e86\u66f4\u6539\u3002<\/p>\n

\u7528\u4e8e\u6b64\u4f20\u8f93\u7684\u547d\u4ee4\u662f\uff1a<\/p>\n

rsync -avS vmdk_file syncuser@host1:\/destination<\/pre>\n

\u540c\u6837\uff0c\u4e86\u89e3 rsync \u7684\u5de5\u4f5c\u65b9\u5f0f\u4e5f\u5c06\u6709\u52a9\u4e8e\u89e3\u51b3\u6b64\u95ee\u9898\u3002<\/p>\n

\u4e0a\u9762\u662f\u5173\u4e8e rsync \u7684\u6700\u5927\u8bef\u89e3\u3002\u6211\u4eec\u8bb8\u591a\u4eba\u8ba4\u4e3a rsync \u53ea\u4f1a\u53d1\u9001\u6587\u4ef6\u7684\u589e\u91cf\u66f4\u65b0\uff0c\u5e76\u4e14\u53ea\u4f1a\u81ea\u52a8\u66f4\u65b0\u9700\u8981\u66f4\u65b0\u7684\u5185\u5bb9\u3002\u4f46\u8fd9\u4e0d\u662f rsync \u7684\u9ed8\u8ba4\u884c\u4e3a\u3002<\/p>\n

\u5982\u624b\u518c\u9875\u6240\u8ff0\uff0crsync \u7684\u9ed8\u8ba4\u884c\u4e3a\u662f\u5728\u76ee\u6807\u4f4d\u7f6e\u521b\u5efa\u6587\u4ef6\u7684\u65b0\u526f\u672c\uff0c\u5e76\u5728\u4f20\u8f93\u5b8c\u6210\u540e\u5c06\u5176\u79fb\u52a8\u5230\u6b63\u786e\u7684\u4f4d\u7f6e\u3002<\/p>\n

\u8981\u66f4\u6539 rsync \u7684\u9ed8\u8ba4\u884c\u4e3a\uff0c\u4f60\u5fc5\u987b\u8bbe\u7f6e\u4ee5\u4e0b\u6807\u5fd7\uff0c\u7136\u540e rsync \u5c06\u4ec5\u53d1\u9001\u589e\u91cf\uff1a<\/p>\n

--inplace               \u539f\u5730\u66f4\u65b0\u76ee\u6807\u6587\u4ef6\r\n--partial               \u4fdd\u7559\u90e8\u5206\u4f20\u8f93\u7684\u6587\u4ef6\r\n--append                \u9644\u52a0\u6570\u636e\u5230\u66f4\u77ed\u7684\u6587\u4ef6\r\n--progress              \u5728\u4f20\u8f93\u65f6\u663e\u793a\u8fdb\u5ea6\u6761<\/pre>\n

\u56e0\u6b64\uff0c\u53ef\u4ee5\u786e\u5207\u5730\u6267\u884c\u6211\u90a3\u4e2a\u670b\u53cb\u60f3\u8981\u7684\u529f\u80fd\u7684\u5b8c\u6574\u547d\u4ee4\u662f\uff1a<\/p>\n

rsync -av --partial --inplace --append --progress vmdk_file syncuser@host1:\/destination<\/pre>\n

\u6ce8\u610f\uff0c\u51fa\u4e8e\u4e24\u4e2a\u539f\u56e0\uff0c\u8fd9\u91cc\u5fc5\u987b\u5220\u9664\u7a00\u758f\u9009\u9879 -S\u3002\u9996\u5148\u662f\u901a\u8fc7\u7f51\u7edc\u53d1\u9001\u6587\u4ef6\u65f6\uff0c\u4e0d\u80fd\u540c\u65f6\u4f7f\u7528 \u2013sparse \u548c \u2013inplace\u3002\u5176\u6b21\uff0c\u5f53\u4f60\u4ee5\u524d\u4f7f\u7528\u8fc7 \u2013sparse \u53d1\u9001\u6587\u4ef6\u65f6\uff0c\u5c31\u65e0\u6cd5\u518d\u4f7f\u7528 \u2013inplace \u8fdb\u884c\u66f4\u65b0\u3002\u8bf7\u6ce8\u610f\uff0c\u4f4e\u4e8e 3.1.3 \u7684 rsync \u7248\u672c\u5c06\u62d2\u7edd \u2013sparse \u548c \u2013inplace \u7684\u7ec4\u5408\u3002<\/p>\n

\u56e0\u6b64\uff0c\u5373\u4f7f\u90a3\u4e2a\u670b\u53cb\u6700\u7ec8\u901a\u8fc7\u7f51\u7edc\u590d\u5236\u4e86 100GB\uff0c\u90a3\u4e5f\u53ea\u9700\u53d1\u751f\u4e00\u6b21\u3002\u4ee5\u4e0b\u6240\u6709\u66f4\u65b0\u4ec5\u590d\u5236\u5dee\u5f02\uff0c\u4ece\u800c\u4f7f\u590d\u5236\u975e\u5e38\u9ad8\u6548\u3002<\/p>\n

via: https:\/\/fedoramagazine.org\/copying-large-files-with-rsync-and-some-misconceptions\/<\/p>\n

\u4f5c\u8005\uff1aDaniel Leite de Abreu \u9009\u9898\uff1alujun9972 \u8bd1\u8005\uff1awxy \u6821\u5bf9\uff1awxy<\/p>\n

\u672c\u6587\u7531 LCTT \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd \u8363\u8a89\u63a8\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"

\u51e0\u5e74\u524d\uff0c\u4e00\u4e2a\u66fe\u7ecf\u5728\u6211\u56e2\u961f\u4e2d\u5de5\u4f5c\u7684\u670b\u53cb\u9700\u8981\u5c06\u865a\u62df\u673a\u6a21\u677f\u4ece\u7ad9\u70b9 A \u590d\u5236\u5230\u7ad9\u70b9 B\u3002\u4ed6\u4eec\u65e0\u6cd5\u7406\u89e3\u4e3a\u4ec0\u4e48\u590d\u5236\u7684\u6587\u4ef6\u5728 […]<\/p>\n","protected":false},"author":1482,"featured_media":82897,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-162662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=162662"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162662\/revisions"}],"predecessor-version":[{"id":162711,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162662\/revisions\/162711"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/82897"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=162662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=162662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=162662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}