{"id":17936,"date":"2025-04-19T00:23:17","date_gmt":"2025-04-18T16:23:17","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/17936.html"},"modified":"2025-04-19T00:23:17","modified_gmt":"2025-04-18T16:23:17","slug":"linux%e7%a3%81%e7%9b%98%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/17936.html","title":{"rendered":"Linux\u78c1\u76d8\u7ba1\u7406"},"content":{"rendered":"<h2>Linux\u78c1\u76d8\u7ba1\u7406<\/h2>\n<p>Linux\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u6570\u636e\u91cf\u4e0d\u65ad\u589e\u5927&#xff0c;\u9010\u6e10\u5bfc\u81f4\u521d\u59cb\u914d\u7f6e\u7684\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3&#xff0c;\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u8fdb\u884c\u6269\u5bb9&#xff0c;\u4ee5\u6ee1\u8db3\u4e1a\u52a1\u9700\u6c42\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u4f1a\u9009\u62e9\u65b0\u6dfb\u52a0\u78c1\u76d8&#xff0c;\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5c06\u65b0\u78c1\u76d8\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u6302\u8f7d\u6216\u5236\u4f5cLVM\u903b\u8f91\u5377&#xff0c;\u8fdb\u884c\u78c1\u76d8\u7a7a\u95f4\u6269\u5bb9\u3002<\/p>\n<h3>1. \u57fa\u672c\u5206\u533a<\/h3>\n<p>\u78c1\u76d8\u7684\u5206\u533a\u683c\u5f0f\u4e00\u5171\u6709\u4e24\u79cd&#xff1a;<\/p>\n<p>\u4e00\u79cd\u662fGPT\u5206\u533a&#xff0c;GPT\u6700\u591a\u652f\u6301128\u4e2a\u4e3b\u5206\u533a&#xff0c;\u6ca1\u6709\u6269\u5c55\u5206\u533a\u548c\u903b\u8f91\u76d8&#xff0c;\u652f\u6301\u4efb\u610f\u5bb9\u91cf\u7684\u78c1\u76d8\u5206\u533a\u3002<\/p>\n<p>\u4e00\u79cd\u662fMBR\u5206\u533a&#xff0c;\u505a\u591a\u56db\u4e2a\u4e3b\u5206\u533a&#xff0c;\u53ef\u4ee5\u505a\u4e09\u4e2a\u4e3b\u5206\u533a\u52a0\u4e00\u4e2a\u6269\u5c55\u5206\u533a&#xff0c;\u6269\u5c55\u5206\u533a\u53ef\u4ee5\u505a\u6210\u8bb8\u591a\u903b\u8f91\u5206\u533a&#xff0c;\u4f46\u5206\u533a\u603b\u6570\u91cf\u4e0d\u80fd\u8d85\u8fc714&#xff0c;2T\u5bb9\u91cf\u4ee5\u4e0b\u7684\u786c\u76d8\u5206\u533a\u4e00\u822c\u5e38\u7528MBR\u683c\u5f0f\u5206\u533a\u3002<\/p>\n<p>\u6dfb\u52a0\u65b0\u78c1\u76d8\u540e&#xff0c;\u901a\u8fc7lsblk(list block)\u547d\u4ee4\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u5757\u8bbe\u5907&#xff0c;\u67e5\u770b\u65b0\u78c1\u76d8\u662f\u5426\u6dfb\u52a0\u6210\u529f\u3002<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162314-68027c7298867.png\" \/><\/p>\n<p>\u56fe\u4e2d\u7684sdb\u76d8\u662f\u4e00\u5757\u65b0\u6dfb\u52a0\u768420G\u78c1\u76d8&#xff0c;\u9700\u8981\u901a\u8fc7\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u6302\u8f7d\u6765\u5bf9\u78c1\u76d8\u8fdb\u884c\u5904\u7406\u624d\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n<h4>1.1 MBR\u5206\u533a<\/h4>\n<p>fdisk \/dev\/sdb  #\u4f7f\u7528fdisk\u5bf9\u78c1\u76d8\u5f00\u59cb\u5206\u533a <\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162314-68027c72b0e1c.png\" \/><\/p>\n<p>\u547d\u4ee4\u53c2\u6570\u5982\u56fe\u6240\u793a&#xff0c;\u5e38\u7528\u7684\u6709&#xff1a;<\/p>\n<p>d   \u5220\u9664\u4e00\u4e2a\u5206\u533a<br \/>\ng   \u521b\u5efa\u4e00\u4e2a\u65b0\u7684GPT\u5206\u533a\u8868<br \/>\nn   \u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5206\u533a<br \/>\no   \u521b\u5efa\u4e00\u4e2a\u65b0\u7684MBR\u5206\u533a\u8868<br \/>\np   \u6253\u5370\u5206\u533a\u8868<br \/>\nq   \u9000\u51fa\u4e0d\u4fdd\u5b58<br \/>\nw   \u4fdd\u5b58\u5e76\u9000\u51fa <\/p>\n<p>\u8f93\u5165n&#xff0c;\u9009\u62e9\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5206\u533a<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162314-68027c72cd123.png\" \/><\/p>\n<p>\u9009\u62e9p\u521b\u5efa\u4e3b\u5206\u533a&#xff0c;\u9009\u62e9e\u521b\u5efa\u6269\u5c55\u5206\u533a&#xff0c;\u56de\u8f66\u9009\u62e9\u9ed8\u8ba4\u503c\u5373\u53ef<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162314-68027c72e2359.png\" \/><\/p>\n<p>\u5206\u533a\u53f7\u548c\u8d77\u59cb\u6247\u533a\u90fd\u56de\u8f66\u9009\u62e9\u9ed8\u8ba4\u503c\u5373\u53ef&#xff0c;Last\u6247\u533a\u4e00\u6b65\u9700\u8981\u624b\u52a8\u8f93\u5165\u60f3\u8981\u5212\u5206\u7684\u5206\u533a\u5927\u5c0f&#043;size{K,M,G}<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c73034b0.png\" \/><\/p>\n<p>\u6700\u540e\u4e00\u6b65\u8f93\u5165w\u9000\u51fa\u5e76\u4fdd\u5b58&#xff0c;\u7b2c\u4e00\u4e2a\u5206\u533a\u8bbe\u7f6e\u5b8c\u6210<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c73226f2.png\" \/><\/p>\n<p>\u518d\u6b21lsblk\u67e5\u770b&#xff0c;sdb\u78c1\u76d8\u4e0b\u5df2\u7ecf\u5206\u51fasdb1\u5206\u533a&#xff0c;\u5927\u5c0f\u4e3a10G&#xff0c;\u4e0b\u4e00\u5bf9\u8be5\u5206\u533a\u5236\u4f5c\u6587\u4ef6\u7cfb\u7edf\u5e76\u6302\u8f7d<\/p>\n<ul>\n<li>\n<p>\u4e00\u822cLinux\u7684\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u6700\u591a\u662fxfs\u548cext4\u4e24\u79cd\u6587\u4ef6\u7cfb\u7edf\u683c\u5f0f&#xff0c;\u6839\u636e\u9700\u8981\u9009\u62e9<\/p>\n<\/li>\n<\/ul>\n<p>mkfs.xfs \/dev\/sdb1<br \/>\nmkfs.ext4 \/dev\/sdb1 <\/p>\n<p>\u8f93\u5165mkfs.xfs \/dev\/sdb1&#xff0c;\u5c06sdb1\u5206\u533a\u5236\u4f5c\u6210xfs\u683c\u5f0f\u7684\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c733d2bb.png\" \/><\/p>\n<p>\u6700\u540e\u4e00\u6b65&#xff0c;\u521b\u5efa\u76ee\u5f55&#xff0c;\u5c06sdb1\u5206\u533a\u6302\u8f7d\u5728\u8be5\u76ee\u5f55\u4e0b\u5373\u53ef<\/p>\n<p>mkdir \/mnt\/guazai<br \/>\nmount \/dev\/sdb1 \/mnt\/guazai <\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c735d1fb.png\" \/><\/p>\n<p>\u6b64\u65f6sdb1\u5206\u533a\u5df2\u7ecf\u6302\u8f7d&#xff0c;\u53ef\u4ee5\u5f00\u59cb\u5199\u5165&#xff0c;\u4f46\u76ee\u524d\u53ea\u662f\u4e34\u65f6\u6302\u8f7d&#xff0c;\u66f4\u6362\u7ec8\u7aef\u6216\u91cd\u542f\u540e\u9700\u8981\u518d\u6b21\u624b\u52a8\u6302\u8f7d&#xff0c;\u6240\u4ee5\u6700\u597d\u505a\u6210\u5f00\u673a\u81ea\u52a8\u6302\u8f7d&#xff0c;\u5728\/etc\/fstab\u6587\u4ef6\u5185\u52a0\u4e0a\u4ee5\u4e0b\u5185\u5bb9&#xff0c;\u5373\u53ef\u5f00\u673a\u81ea\u52a8\u6302\u8f7d<\/p>\n<p>\/dev\/sdb1 \/mn\/guazai \u00a0  xfs \u00a0 \u00a0     defaults \u00a0  0 \u00a0 \u00a0 0<br \/>\n \u00a0 \u5206\u533a \u00a0 \u00a0  \u6302\u8f7d\u70b9 \u00a0 \u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b \u6587\u4ef6\u7cfb\u7edf\u5c5e\u6027 \u4e0d\u5907\u4efd \u4e0d\u68c0\u67e5<br \/>\n#\u6dfb\u52a0\u5b8c\u6210\u540e\u4f7f\u7528mount -a\u547d\u4ee4\u68c0\u67e5&#xff0c;\u6dfb\u52a0\u9519\u8bef\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u542f\u52a8\u51fa\u9519&#xff0c;\u8c28\u614e\u64cd\u4f5c&#xff01; <\/p>\n<h4>1.2 GPT\u5206\u533a<\/h4>\n<p>GPT\u5206\u533a\u4f7f\u7528gdisk\u547d\u4ee4&#xff0c;\u5176\u4ed6\u4e0efdisk\u547d\u4ee4\u64cd\u4f5c\u65b9\u6cd5\u57fa\u672c\u4e00\u81f4&#xff0c;\u6309\u63d0\u793a\u8fdb\u884c\u64cd\u4f5c\u5373\u53ef<\/p>\n<p>\u5206\u533a\u6dfb\u52a0\u6210\u529f\u540e&#xff0c;\u5236\u4f5c\u6587\u4ef6\u7cfb\u7edf\u3001\u6302\u8f7d\u3001\u81ea\u52a8\u6302\u8f7d\u64cd\u4f5c\u540c\u524d\u6587<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c7375270.png\" \/><\/p>\n<h3>2. LVM\u903b\u8f91\u5377\u5206\u533a<\/h3>\n<p>\u57fa\u672c\u5206\u533a\u5927\u5c0f\u65e0\u6cd5\u8c03\u6574&#xff0c;\u5199\u5165\u6570\u636e\u5360\u6ee1\u65f6\u4fbf\u65e0\u6cd5\u7ee7\u7eed\u4f7f\u7528&#xff0c;\u6574\u4f53\u6570\u636e\u8fc1\u79fb\u53c8\u975e\u5e38\u9ebb\u70e6&#xff0c;\u800cLVM\u903b\u8f91\u5377\u5206\u533a\u7684\u7279\u70b9\u5c31\u662f\u53ef\u4ee5\u968f\u610f\u6269\u5bb9&#xff0c;\u89c4\u907f\u78c1\u76d8\u5360\u6ee1\u65f6\u7684\u6570\u636e\u4e22\u5931\u98ce\u9669\u3002<\/p>\n<ul>\n<li>\n<p>\u7269\u7406\u5377&#xff08;Physical Volume,PV&#xff09;&#xff1a;\u4e5f\u5c31\u662f\u5c06\u7269\u7406\u78c1\u76d8\u5206\u533a\u8f6c\u5316\u4e3aLVM\u53ef\u8bc6\u522b\u7684\u503c\u3002<\/p>\n<\/li>\n<li>\n<p>\u5377\u7ec4&#xff08;Volume Group,VG&#xff09;&#xff1a;PV\u7684\u96c6\u5408<\/p>\n<\/li>\n<li>\n<p>\u903b\u8f91\u5377&#xff08;Logic Volume,LV&#xff09;&#xff1a;VG\u4e2d\u753b\u51fa\u6765\u7684\u4e00\u5757\u903b\u8f91\u78c1\u76d8<\/p>\n<\/li>\n<\/ul>\n<p>\u9996\u5148\u5f15\u5165PV\u3001VG\u3001LV\u7684\u6982\u5ff5&#xff0c;\u7269\u7406\u78c1\u76d8\u6216\u8005\u78c1\u76d8\u5206\u533a\u8f6c\u6362\u4e3a\u7269\u7406\u5377&#xff0c;\u4e00\u4e2a\u6216\u591a\u4e2a\u7269\u7406\u5377\u805a\u96c6\u5f62\u6210\u4e00\u4e2a\u6216\u591a\u4e2a\u5377\u7ec4&#xff0c;\u800c\u903b\u8f91\u5377\u5c31\u662f\u4ece\u67d0\u4e2a\u5377\u7ec4\u91cc\u9762\u62bd\u8c61\u51fa\u6765\u7684\u4e00\u5757\u78c1\u76d8\u7a7a\u95f4\u3002<\/p>\n<h4>2.1 \u521b\u5efa\u903b\u8f91\u5377<\/h4>\n<p>step1<\/p>\n<p>pvcreate \/dev\/sdc   #\u5c06\u65b0\u78c1\u76d8sdc\u5236\u4f5c\u6210\u7269\u7406\u5377<br \/>\n\u521b\u5efa\u5b8c\u6210\u540e\u4f7f\u7528pvs\u3001pvscan\u3001pvdisplay\u4efb\u610f\u4e00\u4e2a\u5373\u53ef\u67e5\u770b <\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c73935e1.png\" \/><\/p>\n<p>step2<\/p>\n<p>vgcreate vg1 \/dev\/sdc   #\u521b\u5efa\u5377\u7ec4vg1\u5e76\u5c06\u7269\u7406\u5377\/dev\/sdc\u52a0\u5230\u5377\u7ec4<br \/>\n\u521b\u5efa\u5b8c\u6210\u540e\u4f7f\u7528vgs\u3001vgscan\u3001vgdisplay\u4efb\u610f\u4e00\u4e2a\u5373\u53ef\u67e5\u770b <\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c73ae541.png\" \/><\/p>\n<p>\u7531\u4e8e\/dev\/sdc\u662f\u4e00\u575720GB\u7684\u65b0\u78c1\u76d8&#xff0c;\u6240\u4ee5vg1\u5269\u4f59\u7a7a\u95f4\u4e3a20GB<\/p>\n<p>step3<\/p>\n<p>lvcreate -L &#043;10G -n lv1 \/dev\/vg1    #\u4ecevg1\u5377\u7ec4\u62ff10GB\u7a7a\u95f4\u505a\u6210\u903b\u8f91\u5377lv1<br \/>\nlvcreate -l &#043;100%FREE -n lv1 \/dev\/vg1   #\u5c06vg1\u5377\u7ec4\u5168\u90e8\u5269\u4f59\u7a7a\u95f4\u505a\u6210\u903b\u8f91\u5377lv1<br \/>\n\u521b\u5efa\u5b8c\u6210\u540e\u4f7f\u7528lvs\u3001lvscan\u3001lvdisplay\u4efb\u610f\u4e00\u4e2a\u5373\u53ef\u67e5\u770b <\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c73ccd4e.png\" \/><\/p>\n<p>step4<\/p>\n<p>mkfs.xfs \/dev\/vg1\/lv1           #\u5236\u4f5c\u6587\u4ef6\u7cfb\u7edf<br \/>\nmkdir \/mnt\/lv1                  #\u521b\u5efa\u6302\u8f7d\u70b9\u76ee\u5f55<br \/>\nmount \/dev\/vg1\/lv1 \/mnt\/lv1     #\u6302\u8f7d<br \/>\necho &#034;\/dev\/vg1\/lv1 \/mnt\/lv1 xfs defaults 0 0&#034; &gt;&gt;\/etc\/fstab      #\u5f00\u673a\u81ea\u52a8\u6302\u8f7d <\/p>\n<h4 style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162315-68027c73e8e01.png\" \/><\/h4>\n<h4>2.2 \u903b\u8f91\u5377\u6269\u5bb9<\/h4>\n<p>\u5f53\u5377\u7ec4\u5185\u7a7a\u95f4\u5145\u8db3\u65f6&#xff0c;\u76f4\u63a5\u4ece\u5377\u7ec4\u5185\u62ff\u7a7a\u95f4\u7ed9\u903b\u8f91\u5377\u6269\u5bb9\u6216\u521b\u5efa\u65b0\u903b\u8f91\u5377<\/p>\n<p>\u5f53\u5377\u7ec4\u5185\u7a7a\u95f4\u4e0d\u8db3\u65f6&#xff0c;\u6dfb\u52a0\u78c1\u76d8\u5236\u4f5c\u6210\u7269\u7406\u5377\u7ed9\u5377\u7ec4\u6269\u5bb9&#xff0c;\u518d\u4ece\u5377\u7ec4\u62ff\u7a7a\u95f4\u7ed9\u903b\u8f91\u5377\u6269\u5bb9<\/p>\n<p>vgextend vg1 \/dev\/sdd(xincipan)     #\u5377\u7ec4\u6269\u5bb9<br \/>\nlvextend -L &#043;10G \/dev\/vg1\/lv1 \u00a0 \u00a0 \u00a0 #\u903b\u8f91\u5377\u6269\u5bb9<\/p>\n<p>\u903b\u8f91\u5377\u6269\u5bb9\u540e\u9700\u8981\u7ed9\u76f8\u5e94\u7684\u6587\u4ef6\u7cfb\u7edf\u6269\u5bb9\u624d\u53ef\u751f\u6548<\/p>\n<p>xfs_growfs \u00a0#xfs\u6587\u4ef6\u7cfb\u7edf\u6269\u5bb9<br \/>\nresize2fs \u00a0 #ext4\u6587\u4ef6\u7cfb\u7edf\u6269\u5bb9 <\/p>\n<h3>3. swap\u4ea4\u6362\u5206\u533a<\/h3>\n<p>Linux\u5185\u6838\u4e3a\u4e86\u63d0\u9ad8\u8bfb\u5199\u6548\u7387\u4e0e\u901f\u5ea6&#xff0c;\u4f1a\u5c06\u6587\u4ef6\u5728\u5185\u5b58\u4e2d\u8fdb\u884c\u7f13\u5b58&#xff0c;\u8fd9\u90e8\u5206\u5185\u5b58\u5c31\u662fCache Memory(\u7f13\u5b58\u5185\u5b58)\u3002\u5373\u4f7f\u4f60\u7684\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u675f\u540e&#xff0c;Cache Memory\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u91ca\u653e\u3002\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4f60\u5728Linux\u7cfb\u7edf\u4e2d\u7a0b\u5e8f\u9891\u7e41\u8bfb\u5199\u6587\u4ef6\u540e&#xff0c;\u4f60\u4f1a\u53d1\u73b0\u53ef\u7528\u7269\u7406\u5185\u5b58\u53d8\u5c11\u3002\u5f53\u7cfb\u7edf\u7684\u7269\u7406\u5185\u5b58\u4e0d\u591f\u7528\u7684\u65f6\u5019&#xff0c;\u5c31\u9700\u8981\u5c06\u7269\u7406\u5185\u5b58\u4e2d\u7684\u4e00\u90e8\u5206\u7a7a\u95f4\u91ca\u653e\u51fa\u6765&#xff0c;\u4ee5\u4f9b\u5f53\u524d\u8fd0\u884c\u7684\u7a0b\u5e8f\u4f7f\u7528\u3002\u90a3\u4e9b\u88ab\u91ca\u653e\u7684\u7a7a\u95f4\u53ef\u80fd\u6765\u81ea\u4e00\u4e9b\u5f88\u957f\u65f6\u95f4\u6ca1\u6709\u4ec0\u4e48\u64cd\u4f5c\u7684\u7a0b\u5e8f&#xff0c;\u8fd9\u4e9b\u88ab\u91ca\u653e\u7684\u7a7a\u95f4\u88ab\u4e34\u65f6\u4fdd\u5b58\u5230Swap\u7a7a\u95f4\u4e2d&#xff0c;\u7b49\u5230\u90a3\u4e9b\u7a0b\u5e8f\u8981\u8fd0\u884c\u65f6&#xff0c;\u518d\u4eceSwap\u5206\u533a\u4e2d\u6062\u590d\u4fdd\u5b58\u7684\u6570\u636e\u5230\u5185\u5b58\u4e2d\u3002\u8fd9\u6837&#xff0c;\u7cfb\u7edf\u603b\u662f\u5728\u7269\u7406\u5185\u5b58\u4e0d\u591f\u65f6&#xff0c;\u624d\u8fdb\u884cSwap\u4ea4\u6362\u3002<\/p>\n<h4>3.1 \u57fa\u672c\u5206\u533a\u3001LVM\u5236\u4f5c\u4ea4\u6362\u5206\u533a<\/h4>\n<p>\u4f7f\u7528free -m\u6216swapon -s\u67e5\u770b\u5f53\u524dswap\u5206\u533a\u4fe1\u606f<\/p>\n<p>\u6b65\u9aa4&#xff1a;<\/p>\n<p>\u5236\u4f5c\u4e00\u4e2a\u65b0\u7684\u57fa\u672c\u5206\u533a\u6216\u903b\u8f91\u5377<br \/>\nmkswap \/dev\/sdb1    \u6216    mkswap \/dev\/vg1\/lv1<br \/>\n#\u521d\u59cb\u5316\u4e3aswap\u5206\u533a<br \/>\necho &#034;\/dev\/sdb1 swap swap defaults 0 0&#034;<br \/>\n\u6216<br \/>\necho &#034;\/dev\/vg1\/lv1 swap swap defaults 0 0&#034;<br \/>\n#\u5236\u4f5c\u5f00\u673a\u6302\u8f7d<br \/>\nswapon -a<br \/>\n#\u6fc0\u6d3bswap\u5206\u533a(\u8bfb\u53d6\/etc\/fstab) <\/p>\n<p>swap\u5206\u533a\u5236\u4f5c\u6210\u529f<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162316-68027c740ea78.png\" \/><\/p>\n<h4>3.2 \u5927\u6587\u4ef6\u5236\u4f5c\u4ea4\u6362\u5206\u533a<\/h4>\n<p>\u9996\u5148\u4f7f\u7528dd\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u8db3\u591f\u5927\u800c\u7a7a\u7684\u6587\u4ef6<\/p>\n<p>dd if&#061;\/dev\/zero of&#061;\/mnt\/file bs&#061;1000M count&#061;20  #\u5728\/mnt\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3afile\u5927\u5c0f\u4e3a20G\u7684\u6587\u4ef6<br \/>\n input file  output file \u00a0  block\u5927\u5c0f \u00a0 \u6570\u91cf \u00a0 \u00a0 \u00a0<br \/>\n \u00a0 \u8f93\u5165\u6587\u4ef6 \u00a0 \u00a0 \u8f93\u51fa\u6587\u4ef6<br \/>\nmkswap \/mnt\/file    #\u683c\u5f0f\u5316\u8be5\u6587\u4ef6<br \/>\necho &#034;\/mnt\/file swap swap defaults 0 0&#034; &gt;&gt;\/etc\/fstab    #\u5236\u4f5c\u5f00\u673a\u6302\u8f7d<br \/>\nswapon -a   #\u6fc0\u6d3b<br \/>\nswapon -s   #\u67e5\u8be2 <\/p>\n<h3>4. \u6ce8\u610f\u4e8b\u9879<\/h3>\n<ul>\n<li>\n<p>\u5f53\u78c1\u76d8\u5df2\u7ecf\u6dfb\u52a0\u4e86\u4e00\u4e2aMBR(GPT)\u5206\u533a\u540e&#xff0c;\u53c8\u60f3\u8f6c\u6362\u4e3aGPT(MBR)\u5206\u533a\u65f6<\/p>\n<p> \u9996\u5148fdisk(gdisk)\u8be5\u5206\u533a&#xff0c;\u4f7f\u7528d\u53c2\u6570\u5220\u9664\u5206\u533a&#xff0c;w\u53c2\u6570\u4fdd\u5b58\u9000\u51fa<br \/>\nparted -s \/dev\/sdb mklabel gpt           #\u5c06\/dev\/sdb(MBR\u683c\u5f0f)\u8f6c\u6362\u6210(GPT\u683c\u5f0f)<br \/>\nparted -s \/dev\/sdb mklabel msdos         #\u5c06\/dev\/sdb(GPT\u683c\u5f0f)\u8f6c\u6362\u6210(MBR\u683c\u5f0f)<br \/>\n\u8f6c\u6362\u5b8c\u6210\u540e\u91cd\u65b0\u8fdb\u884c\u5206\u533a\u64cd\u4f5c <\/li>\n<li>\n<p>\u7b2c\u4e00\u4e2a\u5206\u533a\u8bbe\u7f6e\u5b8c\u6210\u540e\u672a\u91cd\u542f\u8bbe\u7f6e\u7b2c\u4e8c\u4e2a\u5206\u533a\u65f6\u4f1a\u62a5\u5982\u56fe\u7684\u9519\u8bef<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162316-68027c742c3f7.png\" \/><\/p>\n<\/li>\n<\/ul>\n<p>partprobe \/dev\/sdb\u6216kpartx \/dev\/sdb  \u66f4\u65b0\u78c1\u76d8\u5206\u533a\u8868&#xff0c;\u624b\u52a8\u8ba9\u5185\u6838\u66f4\u65b0\u5206\u533a\u8868\u3002\u4e0d\u9700\u8981\u91cd\u542f <\/p>\n<ul>\n<li>\n<p>\u5206\u533a\u6216\u903b\u8f91\u5377\u6302\u8f7d\u65f6\u6700\u597d\u662f\u7a7a\u76ee\u5f55&#xff0c;\u56e0\u4e3a\u6302\u8f7d\u540e\u4f1a\u5c06\u76ee\u5f55\u4e0b\u7684\u4e1c\u897f\u8986\u76d6&#xff0c;\u5378\u8f7d\u540e\u624d\u80fd\u8bbf\u95ee<\/p>\n<\/li>\n<li> mount\u547d\u4ee4\u6302\u8f7d\u65f6\u53ef\u4ee5-o\u6307\u5b9a\u4e0b\u5217\u53c2\u6570<br \/>\n-o \u00a0 \u00a0 \u00a0 \u00a0 \u6307\u5b9a\u6587\u4ef6\u7cfb\u7edf\u5c5e\u6027<br \/>\nrw   \u00a0 \u00a0 \u00a0 \u8bfb\u5199<br \/>\nro   \u00a0 \u00a0 \u00a0 \u53ea\u8bfb<br \/>\nnoexec   \u00a0 \u4e0d\u5141\u8bb8\u6267\u884c\u4e8c\u8fdb\u5236\u6587\u4ef6<br \/>\nexec     \u00a0 \u5141\u8bb8\u6267\u884c\u4e8c\u8fdb\u5236\u6587\u4ef6<br \/>\nauto     \u00a0 mount -a \u5f00\u673a\u81ea\u52a8\u6302\u8f7d<br \/>\nremount  \u00a0 \u5728\u7ebf\u91cd\u65b0\u6302\u8f7d  <\/p>\n<\/li>\n<li> lvremove        #\u903b\u8f91\u5377\u79fb\u9664<br \/>\nvgremove        #\u5377\u7ec4\u79fb\u9664<br \/>\npvremove        #\u7269\u7406\u5377\u79fb\u9664 <\/p>\n<\/li>\n<li> umount \/dev\/sdb     #\u5378\u8f7d<br \/>\numount -l \/dev\/sdb  #\u5f3a\u5236\u5378\u8f7d <\/p>\n<\/li>\n<li>\n<p>\u4eceMBR\u8f6c\u5230GPT&#xff0c;\u6216\u4eceGPT\u8f6c\u6362\u5230MBR\u4f1a\u5bfc\u81f4\u6570\u636e\u5168\u90e8\u4e22\u5931&#xff01;\u56e0\u4e3a\u8f6c\u6362\u683c\u5f0f\u8981\u683c\u5f0f\u5316\u786c\u76d8&#xff01;<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4k\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf35\u6b21\u3002Linux\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u6570\u636e\u91cf\u4e0d\u65ad\u589e\u5927\uff0c\u9010\u6e10\u5bfc\u81f4\u521d\u59cb\u914d\u7f6e\u7684\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u8fdb\u884c\u6269\u5bb9\uff0c\u4ee5\u6ee1\u8db3\u4e1a\u52a1\u9700\u6c42\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u4f1a\u9009\u62e9\u65b0\u6dfb\u52a0\u78c1\u76d8\uff0c\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5c06\u65b0\u78c1\u76d8\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u6302\u8f7d\u6216\u5236\u4f5cLVM\u903b\u8f91\u5377\uff0c\u8fdb\u884c\u78c1\u76d8\u7a7a\u95f4\u6269\u5bb9\u3002_linux\u91cd\u65b0\u5206\u914d\u78c1\u76d8\u7a7a\u95f4<\/p>\n","protected":false},"author":2,"featured_media":17921,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-17936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u78c1\u76d8\u7ba1\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/17936.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u78c1\u76d8\u7ba1\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4k\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf35\u6b21\u3002Linux\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u6570\u636e\u91cf\u4e0d\u65ad\u589e\u5927\uff0c\u9010\u6e10\u5bfc\u81f4\u521d\u59cb\u914d\u7f6e\u7684\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u8fdb\u884c\u6269\u5bb9\uff0c\u4ee5\u6ee1\u8db3\u4e1a\u52a1\u9700\u6c42\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u4f1a\u9009\u62e9\u65b0\u6dfb\u52a0\u78c1\u76d8\uff0c\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5c06\u65b0\u78c1\u76d8\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u6302\u8f7d\u6216\u5236\u4f5cLVM\u903b\u8f91\u5377\uff0c\u8fdb\u884c\u78c1\u76d8\u7a7a\u95f4\u6269\u5bb9\u3002_linux\u91cd\u65b0\u5206\u914d\u78c1\u76d8\u7a7a\u95f4\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/17936.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T16:23:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162314-68027c7298867.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17936.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/17936.html\",\"name\":\"Linux\u78c1\u76d8\u7ba1\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T16:23:17+00:00\",\"dateModified\":\"2025-04-18T16:23:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/17936.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/17936.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17936.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u78c1\u76d8\u7ba1\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\u78c1\u76d8\u7ba1\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/17936.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u78c1\u76d8\u7ba1\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4k\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf35\u6b21\u3002Linux\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u6570\u636e\u91cf\u4e0d\u65ad\u589e\u5927\uff0c\u9010\u6e10\u5bfc\u81f4\u521d\u59cb\u914d\u7f6e\u7684\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u8fdb\u884c\u6269\u5bb9\uff0c\u4ee5\u6ee1\u8db3\u4e1a\u52a1\u9700\u6c42\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u4f1a\u9009\u62e9\u65b0\u6dfb\u52a0\u78c1\u76d8\uff0c\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5c06\u65b0\u78c1\u76d8\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u6302\u8f7d\u6216\u5236\u4f5cLVM\u903b\u8f91\u5377\uff0c\u8fdb\u884c\u78c1\u76d8\u7a7a\u95f4\u6269\u5bb9\u3002_linux\u91cd\u65b0\u5206\u914d\u78c1\u76d8\u7a7a\u95f4","og_url":"https:\/\/www.wsisp.com\/helps\/17936.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T16:23:17+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418162314-68027c7298867.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/17936.html","url":"https:\/\/www.wsisp.com\/helps\/17936.html","name":"Linux\u78c1\u76d8\u7ba1\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T16:23:17+00:00","dateModified":"2025-04-18T16:23:17+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/17936.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/17936.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/17936.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u78c1\u76d8\u7ba1\u7406"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=17936"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17936\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/17921"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=17936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=17936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=17936"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=17936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}