人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

Linux系統(tǒng)怎么調整swap分區(qū)大小?

發(fā)布日期:2022-01-30 16:22 | 文章來源:CSDN

這里介紹Linux系統(tǒng)中調整swap大小的方法。

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

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

3、創(chuàng)建一個swap文件

復制內容到剪貼板
  1. ########
  2. ddif=/dev/zeroof=/tmp/swapbs=1MBcount=1024
  3. ########

以下僅供參考:不用看

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/mntand we want to use the file/mnt/myswap.swpfor swapping.

使用下面的命令創(chuàng)建一個1G的swap文件

復制內容到剪貼板
  1. Usethefollowingcommandtocreatea1024MBfilethatwewilluseforswapping
  2. ########
  3. ddif=/dev/zeroof=/mnt/myswap.swpbs=1024MBcount=1
  4. ########

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

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

以下僅供參考:不用看

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. swapon/tmp/swap
  3. ########

使用一個swap分區(qū),如果已經(jīng)有一個swap分區(qū),該步驟可以省略

以下僅供參考:不用看

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. swapoff/tmp/swap
  3. ########

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

香港服務器租用

版權聲明:本站文章來源標注為YINGSOO的內容版權均為本站所有,歡迎引用、轉載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內容涉嫌侵權,請聯(lián)系alex-e#qq.com處理。

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務

7x24全年不間斷在線

專屬顧問服務

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務熱線

關注
微信

關注官方微信
頂部