国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux系統怎么調整swap分區大小?

2020-07-10 11:13:01
字體:
來源:轉載
供稿:網友

這里介紹Linux系統中調整swap大小的方法。

1、使用free命令帶上m參數,查看swap文件大小,官方建議在RAM是2到4.5G時,swap是RAM的2倍;如果RAM大于等于4G則swap等于RAM即可

2、也可用cat 查看etc目錄下的swaps文件,如下圖

3、創建一個swap文件

復制內容到剪貼板
  1. ########   
  2.   
  3. dd if=/dev/zero of=/tmp/swap bs=1MB count=1024   
  4.   
  5. ########  

以下僅供參考:不用看

Creating a swap file

First of, make sure the file system the disk you wish to swap on is properly mounted. For the purposes of this tutorial we will assume the disk is mounted as /mnt and we want to use the file /mnt/myswap.swp for swapping.

使用下面的命令創建一個1G的swap文件

復制內容到剪貼板
  1. Use the following command to create a 1024MB file that we will use for swapping   
  2.   
  3. ########   
  4.   
  5. dd if=/dev/zero of=/mnt/myswap.swp bs=1024MB count=1   
  6.   
  7. ########  

4、制作一個swap文件,如果覺得繁瑣,可以將mkswap文件掛載到tmp目錄下,例如:

復制內容到剪貼板
  1. ########   
  2.   
  3. mkswap /tmp/swap   
  4.   
  5. ########  

以下僅供參考:不用看

Preparing the swap file

Before we enable the swap file we must first set it up. The following command accomplishes just that:

########

mkswap /mnt/myswap.swp

########

5、使用swapon 啟動/tmp/swap

復制內容到剪貼板
  1. ########   
  2.   
  3. swapon /tmp/swap   
  4.   
  5. ########  

使用一個swap分區,如果已經有一個swap分區,該步驟可以省略

以下僅供參考:不用看

Using a swap partition

Setting up a swap partition is a bit more difficult, as the partition must be first created then formatted using the linux-swap file system. Once that is done, assuming the swap partition is at/dev/scsi/host0/bus0/target0/lun0/part5 (common for v24 USB drives with mutiple partitions), the only command that needs be issued is:

6、再次使用free查看增加后的swap大小

7、如果只想增加swap大小,請忽略以下的操作,重要!!如果不使用剛才增加的1G的swap文件,使用下面的swapoff命令,可以關閉,這樣swap文件就縮小了1G

使用swapoff關閉swap文件

復制內容到剪貼板
  1. ########   
  2.   
  3. swapoff /tmp/swap   
  4.   
  5. ########  

注意事項:如果只想增加swap大小,請忽略第7步的所有操作。

相關推薦:

linux系統怎么增加swap分區空間小?

CentOS技巧:減小Linux swap分區的方法

Linux下swap耗盡該怎么辦?如何釋放swap?

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湘潭市| 龙泉市| 元阳县| 滕州市| 江油市| 安吉县| 甘洛县| 静海县| 木里| 长宁县| 稷山县| 赤水市| 新河县| 西乌珠穆沁旗| 米易县| 南汇区| 葫芦岛市| 平阴县| 沂源县| 涡阳县| 庆城县| 林甸县| 安西县| 凤庆县| 鄂托克旗| 沂水县| 新昌县| 墨脱县| 巢湖市| 石柱| 岳普湖县| 彭山县| 永兴县| 荥经县| 海南省| 上思县| 阜康市| 保康县| 科技| 安岳县| 海安县|