{"id":77924,"date":"2023-09-10T21:58:04","date_gmt":"2023-09-10T13:58:04","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=77924"},"modified":"2023-09-10T21:58:04","modified_gmt":"2023-09-10T13:58:04","slug":"linux-swap-partition","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-swap-partition.html","title":{"rendered":"Linux \u4e0a\u521b\u5efa\u6216\u6269\u5c55\u4ea4\u6362\u5206\u533a\u7684\u65b9\u6cd5!"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u7528\u6237\u53ef\u4ee5\u5728\u4efb\u4f55 Linux \u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6216\u8005\u662f\u5176\u5b83\u5fc5\u8981\u7684\u65f6\u5019\u521b\u5efa\u4ea4\u6362\u7a7a\u95f4\u3002\u5982\u679c\u4f60\u5728\u5b89\u88c5 Linux \u7684\u65f6\u5019\u5fd8\u8bb0\u4e86\u521b\u5efa\u6216\u662f\u4f60\u60f3\u8981\u518d\u589e\u52a0\u4ea4\u6362\u5206\u533a\u7684\u7a7a\u95f4\uff0c\u4f60\u968f\u65f6\u90fd\u53ef\u4ee5\u518d\u521b\u5efa\u6216\u589e\u52a0\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u6709\u65f6\u5019\u5728\u4f60\u5b89\u88c5\u540e\u6447\u5347\u7ea7 RAM \u7684\u65f6\u5019\u9700\u8981\u589e\u52a0\u4e00\u70b9\u4ea4\u6362\u5206\u533a\u7684\u7a7a\u95f4\uff0c\u6bd4\u5982\u4f60\u8981\u5c06\u4f60\u7684\u7cfb\u7edf\u7684 RAM \u4ece 1GB \u5347\u7ea7\u5230 2GB \u4f60\uff0c\u90a3\u4e48\u4f60\u5c31\u4e0d\u5f97\u4e0d\u5c06\u4f60\u7684\u4ea4\u6362\u5206\u533a\u7a7a\u95f4\u4e5f\u5347\u7ea7\u4e00\u4e0b\uff08\u4ece 2GB \u5230 4GB\uff09\uff0c\u8fd9\u662f\u56e0\u4e3a\u5b83\u4f7f\u7528\u7684\u5bb9\u91cf\u662f\u7269\u7406 RAM \u7684\u53cc\u500d\u5bb9\u91cf\u3002\uff08LCTT \u8bd1\u6ce8\uff1a\u5176\u5b9e\u8fd9\u91cc\u662f\u4e2a\u8bef\u533a\uff0c\u4ea4\u6362\u5206\u533a\u4e0d\u4e00\u5b9a\u975e\u5f97\u662f\u53cc\u500d\u7684\u7269\u7406\u5185\u5b58\u5bb9\u91cf\uff0c\u53ea\u662f\u60ef\u4f8b\u5982\u6b64\u3002\u4e8b\u5b9e\u4e0a\uff0c\u5982\u679c\u4f60\u7684\u7269\u7406\u5185\u5b58\u8db3\u591f\u7684\u8bdd\uff0c\u4f60\u5b8c\u5168\u53ef\u4ee5\u4e0d\u7528\u4ea4\u6362\u5206\u533a\u2014\u2014\u5728\u8fd9\u91cc\u7684\u60c5\u5f62\u4e0b\uff0c\u6216\u8bb8\u4f60\u589e\u52a0\u4e86\u7269\u7406\u5185\u5b58\uff0c\u5c31\u6ca1\u5fc5\u8981\u589e\u52a0\u4ea4\u6362\u5206\u533a\u5927\u5c0f\u4e86\u3002\uff09<\/p>\n \u4ea4\u6362\u7a7a\u95f4\u662f\u5f53\u7269\u7406\u5185\u5b58\uff08RAM \u968f\u673a\u5b58\u53d6\u5b58\u50a8\u5668\uff09\u7684\u7528\u91cf\u5df2\u6ee1\u65f6\uff0c\u88ab\u4fdd\u7559\u7528\u4f5c\u865a\u62df\u5185\u5b58\u7684\u78c1\u76d8\u4e0a\u7684\u7a7a\u95f4\u3002 \u5982\u679c\u7cfb\u7edf\u5728 RAM \u6ee1\u8f7d\u65f6\u9700\u8981\u66f4\u591a\u7684\u5185\u5b58\u8d44\u6e90\uff0c\u5185\u5b58\u4e2d\u7684\u975e\u6d3b\u52a8\u9875\u9762\u5c06\u88ab\u79fb\u52a8\u5230\u4ea4\u6362\u7a7a\u95f4\uff0c\u8fd9\u6837\u53ef\u4ee5\u5e2e\u52a9\u7cfb\u7edf\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u66f4\u591a\u7684\u65f6\u95f4\uff0c\u4f46\u4e0d\u5e94\u8be5\u628a\u5b83\u5f53\u505a RAM \u7684\u6269\u5c55\u3002<\/p>\n \u5efa\u8bae\u4f60\u521b\u5efa\u4e00\u4e2a\u4e13\u7528\u7684\u4ea4\u6362\u5206\u533a\uff0c\u4f46\u662f\u5982\u679c\u4f60\u6ca1\u6709\u53ef\u7528\u7684\u5206\u533a\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528\u4ea4\u6362\u6587\u4ef6\uff0c\u6216\u4ea4\u6362\u5206\u533a\u548c\u4ea4\u6362\u6587\u4ef6\u7684\u7ec4\u5408\u3002 \u4ea4\u6362\u7a7a\u95f4\u901a\u5e38\u5efa\u8bae\u7528\u6237\u81f3\u5c11 4 GB\uff0c\u7528\u6237\u4e5f\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u8981\u6c42\u548c\u73af\u5883\u521b\u5efa\u4ea4\u6362\u7a7a\u95f4\u3002<\/p>\n \u6211\u53d1\u73b0\u5927\u90e8\u5206 VM \u548c \u4e91\u670d\u52a1\u5668\u90fd\u6ca1\u6709\u4ea4\u6362\u5206\u533a\uff0c\u6240\u4ee5\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e09\u79cd\u65b9\u6cd5\u521b\u5efa\uff0c\u6269\u5c55\u6216\u589e\u52a0\u4ea4\u6362\u7a7a\u95f4\u3002<\/p>\n \u5982\u4f55\u68c0\u6d4b\u5f53\u524d\u4ea4\u6362\u5206\u533a\u5927\u5c0f<\/strong><\/div>\n \u901a\u8fc7 free & swapon \u547d\u4ee4\u6765\u68c0\u6d4b\u5f53\u524d\u7684\u4ea4\u6362\u5206\u533a\u7a7a\u95f4\u7684\u5927\u5c0f\u3002<\/p>\n $ free -h\r\ntotal used free shared buff\/cache available\r\nMem: 2.0G 1.3G 139M 45M 483M 426M\r\nSwap: 2.0G 655M 1.4G\r\n$ swapon --show\r\nNAME TYPE SIZE USED PRIO\r\n\/dev\/sda5 partition 2G 655.2M -1<\/pre>\n |