{"id":87,"date":"2021-05-03T22:45:11","date_gmt":"2021-05-03T13:45:11","guid":{"rendered":"https:\/\/tech.wencloud.net\/?p=87"},"modified":"2021-12-14T21:34:19","modified_gmt":"2021-12-14T12:34:19","slug":"%e4%bd%bf%e7%94%a8tar%e5%91%bd%e4%bb%a4%e5%a4%87%e4%bb%bd%e5%a4%8d%e5%8e%9fubuntu%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"https:\/\/tech.wen.tokyo\/?p=87","title":{"rendered":"\u4f7f\u7528tar\u547d\u4ee4\u5907\u4efd\u590d\u539fUbuntu\u7cfb\u7edf"},"content":{"rendered":"\n<p>\u524d\u4e00\u9635\u5b50\u4e00\u76f4\u7814\u7a76Linux\u7cfb\u7edf\u5982\u4f55\u5907\u4efd\u6062\u590d\u3002\u5728\u4e00\u7bc7\u4e2d\u6587\u535a\u5ba2\u4e2d\u53d1\u73b0\u7684\u4e00\u79cd\u7b80\u5355\u65b9\u6cd5\uff0c\u90a3\u5c31\u4f7f\u7528tar\u547d\u4ee4\u3002\u7531\u4e8e\u4e8b\u5173\u91cd\u5927\uff0c\u641e\u4e0d\u597d\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4f1a\u6302\u6389\uff0c\u6240\u4ee5\u4e00\u76f4\u6ca1\u6709\u5c1d\u8bd5\uff0c\u540e\u6765\u4e0d\u4e86\u4e86\u4e4b\u3002<\/p>\n\n\n\n<p>\u6700\u8fd1\u60f3\u628a\u6811\u8393\u6d3e\u7684\u7cfb\u7edf\u76d8\u7531usb\u6362\u56desd\uff0c\u4e8e\u662f\u53c8\u67e5\u5230\u4e86Ubuntu\u5b98\u65b9\u7684\u6587\u6863\uff0c\u6da8\u4e86\u4e0d\u5c11\u77e5\u8bc6\uff0c\u73b0\u5728\u8bb0\u5f55\u4e00\u4e0b\u3002\u5148\u4e0a\u5907\u4efd\u7684\u547d\u4ee4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -cvpzf \/var\/hdd500g\/backup.tar.gz --exclude=\/var\/hdd500g\/* --one-file-system \/<\/code><\/pre>\n\n\n\n<p>\u89e3\u91ca\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<p>-c \u65b0\u5efa\u538b\u7f29\u6587\u4ef6<\/p>\n\n\n\n<p>-v \u663e\u793a\u6a21\u5f0f\uff0c\u538b\u7f29\u65f6\u4f1a\u663e\u793a\u6bcf\u4e00\u4e2a\u5904\u7406\u6587\u4ef6\u3002\uff08\u5c31\u770b\u5c4f\u5e55\u5237\u5237\u7684\u3002\u3002\u3002\uff09<\/p>\n\n\n\n<p>-p \u4fdd\u5b58\u6587\u4ef6\u6743\u9650\u4fe1\u606f<\/p>\n\n\n\n<p>-z gzip\u538b\u7f29\u65b9\u6cd5\uff0c\u4e5f\u53ef\u4ee5\u6362\u6210bz2\u7684j<\/p>\n\n\n\n<p>-f \u6307\u5b9a\u5907\u4efd\u6587\u4ef6\u4f4d\u7f6e<\/p>\n\n\n\n<p>&#8211;exclude \u8df3\u8fc7\u4e0d\u9700\u8981\u5907\u4efd\u7684\u6587\u4ef6\uff08\u53ef\u4ee5\u7528*\u6307\u5b9a\uff09\uff0c\u53ef\u4ee5\u591a\u91cd\u6307\u5b9a(\u4e0d\u80fd\u5149\u6307\u5b9a\u8def\u5f84\uff0c\u5426\u5219\u91cc\u9762\u7684\u6587\u4ef6\u4f1a\u88ab\u5907\u4efd\u3002\u3002\u3002)<\/p>\n\n\n\n<p>\u6700\u91cd\u8981\u7684\uff0c\u662f\u4e0b\u9762\u8fd9\u4e2a\u3002<\/p>\n\n\n\n<p>&#8211;one-file-system \u7b80\u800c\u8a00\u4e4b\uff0c\u5c31\u662f\u53ea\u5907\u4efd\u5fc5\u8981\u7684\u6587\u4ef6\u3002\u5ffd\u7565\u5185\u5b58\u91cc\u521b\u5efa\u7684\uff0c\u8fd8\u6709\u6302\u8f7d\u7684\u3002\u5b98\u65b9\u7ed9\u51fa\u7684\u82f1\u6587\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Do not include files on a different filesystem. If you want other filesystems, such as a&nbsp;\/home&nbsp;partition, or external media mounted in&nbsp;\/media&nbsp;backed up, you either need to back them up separately, or omit this flag. If you do omit this flag, you will need to add several more&nbsp;<strong>&#8211;exclude=<\/strong>&nbsp;arguments to avoid filesystems you do not want. These would be&nbsp;\/proc,&nbsp;\/sys,&nbsp;\/mnt,&nbsp;\/media,&nbsp;\/run&nbsp;and&nbsp;\/dev&nbsp;directories in root.&nbsp;\/proc&nbsp;and&nbsp;\/sys&nbsp;are virtual filesystems that provide windows into variables of the running kernel, so you do not want to try and backup or restore them.&nbsp;\/dev&nbsp;is a tmpfs whose contents are created and deleted dynamically by udev, so you also do not want to backup or restore it. Likewise,&nbsp;\/run&nbsp;is a tmpfs that holds variables about the running system that do not need backed up.<\/p><\/blockquote>\n\n\n\n<p>\u6700\u540e\u8fd9\u4e2a\u771f\u662f\u592a\u6709\u5e2e\u52a9\u4e86\uff0c\u5b66\u5230\u4e86\u611f\u89c9\u8d5a\u5230\u4e86\uff0c\u54c8\u54c8<\/p>\n\n\n\n<p>\u6700\u540e\u4e00\u4e2a\u201c\uff0f\u201d\uff0c\u8981\u5907\u4efd\u7684\u76ee\u5f55\u3002\u5343\u4e07\u4e0d\u8981\u4e00\u9ad8\u5174\u5fd8\u8bb0\u6572\u5566\uff01<\/p>\n\n\n\n<p>\u6062\u590d\u7cfb\u7edf\u547d\u4ee4\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xvpzf \/home\/ubuntu\/backup.tar.gz -C \/<\/code><\/pre>\n\n\n\n<p>-x \u89e3\u538b\u7f29<\/p>\n\n\n\n<p>-C \u89e3\u538b\u7f29\u4f4d\u7f6e\uff0c\u6839\u76ee\u5f55\uff0c\u522b\u5f04\u9519\u5566\u3002\u5426\u5219\u5c31\u4e0d\u662f\u6062\u590d\u7cfb\u7edf\u5566\uff01\uff01\uff01<\/p>\n\n\n\n<p>\u6211\u662f\u5728\u4e24\u4e2a\u76f8\u540c\u7248\u672c\u7684Ubuntu\u4e0b\u6572\u7684\u547d\u4ee4\uff0c\u91cd\u542f\u4e00\u4e0b\uff0c\u4e00\u5207\u6b63\u5e38\uff01<\/p>\n\n\n\n<p>\u795d\u4f60\u597d\u8fd0\uff01<\/p>\n\n\n\n<p>\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d\uff0d<\/p>\n\n\n\n<p>\u53c2\u8003\u6587\u7ae0\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/help.ubuntu.com\/community\/BackupYourSystem\/TAR\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/blog.csdn.net\/Peter_san\/article\/details\/6083353\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u4e00\u9635\u5b50\u4e00\u76f4\u7814\u7a76Linux\u7cfb\u7edf\u5982\u4f55\u5907\u4efd\u6062\u590d\u3002\u5728\u4e00\u7bc7\u4e2d\u6587\u535a\u5ba2\u4e2d\u53d1\u73b0\u7684\u4e00\u79cd\u7b80\u5355\u65b9\u6cd5\uff0c\u90a3\u5c31\u4f7f\u7528tar\u547d\u4ee4\u3002\u7531\u4e8e\u4e8b\u5173\u91cd&hellip; <a href=\"https:\/\/tech.wen.tokyo\/?p=87\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">\u4f7f\u7528tar\u547d\u4ee4\u5907\u4efd\u590d\u539fUbuntu\u7cfb\u7edf<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-87","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87"}],"version-history":[{"count":3,"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":123,"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions\/123"}],"wp:attachment":[{"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.wen.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}