校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > Linux系統怎么調整swap分區大小?

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

熱門標簽:申請400電話流程好嗎 柯城手機地圖如何做地圖標注 軟件電話機器人 襄陽地圖標注店 萊蕪移動外呼系統 金華呼叫中心外呼系統廠家 小語股票電銷機器人 高德地圖標注在電腦上 杭州電銷機器人有效果嗎

這里介紹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?

標簽:九江 臺州 昌都 海東 優質穩定 孝感 玉樹 哈密

巨人網絡通訊聲明:本文標題《Linux系統怎么調整swap分區大小?》,本文關鍵詞  Linux,系統,怎么,調整,swap,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Linux系統怎么調整swap分區大小?》相關的同類信息!
  • 本頁收集關于Linux系統怎么調整swap分區大小?的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 义马市| 准格尔旗| 嘉定区| 昌图县| 开封市| 德格县| 都兰县| 松溪县| 平利县| 杭锦后旗| 天峨县| 巢湖市| 清丰县| 西青区| 图木舒克市| 鹤山市| 太康县| 柞水县| 嘉义市| 锡林郭勒盟| 香河县| 新化县| 淮阳县| 县级市| 德庆县| 射阳县| 罗源县| 五大连池市| 利川市| 舞阳县| 浮山县| 遂宁市| 黔江区| 张家港市| 景泰县| 上饶县| 瓮安县| 平泉县| 开封县| 资溪县| 尚志市|