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

主頁 > 知識庫 > redhat linux swap分區擴展的三種方法詳解

redhat linux swap分區擴展的三種方法詳解

熱門標簽:潮州地圖標注 安陽百應電銷機器人加盟 百度中國地圖標注中心 pageadm實現地圖標注 依蘭縣地圖標注app 公司400電話辦理價格 山東企業電銷機器人價格 琿春市地圖標注app 百度地圖標注開鎖電話

redhat linux swap分區擴展的三種方法

swap 介紹:

當物理內存占用完了后,當系統還需要更多的物理內存時,物理內存中inactive pages ,就move到swap空間。swap 空間是在位于硬盤上的,因此訪問速度較物理內存慢。

當機器的物理內存發生變化時,swap 分區也要做相應的擴展:

有三種方法可以對swap 分區進行擴展:

一、擴展正在使用的swap 分區的邏輯卷(推薦使用此種方式)

二、新建swap 分區,

三、新建swap file,

具體步驟如下:

一、擴展正在使用的swap 分區的邏輯卷

設定用作swap 分區的邏輯卷為:/dev/VolGroup00/LogVol01

Disable swapping for the associated logical volume:

# swapoff -v /dev/VolGroup00/LogVol01

Resize the LVM2 logical volume by 256 MB:

# lvm lvresize /dev/VolGroup00/LogVol01 -L +256M

Format the new swap space:

# mkswap /dev/VolGroup00/LogVol01

Enable the extended logical volume:

# swapon -va

Test that the logical volume has been extended properly:

# cat /proc/swaps 或者# free

二、新建swap 分區

設定新建的swap 分區的邏輯卷為:/dev/VolGroup00/LogVol02

Create the LVM2 logical volume of size 256 MB:

# lvm lvcreate VolGroup00 -n LogVol02 -L 256M

Format the new swap space:

# mkswap /dev/VolGroup00/LogVol02

Add the following entry to the /etc/fstab file:

/dev/VolGroup00/LogVol02 swap swap defaults 0 0

Enable the extended logical volume:

# swapon -va

Test that the logical volume has been extended properly:

# cat /proc/swaps 或者# free

三、新建swapfile

通過此種方式進行swap 的擴展,首先要計算出block的數目。具體為根據需要擴展的swapfile的大小,以M為單位。block=swap分區大小*1024, 例如,需要擴展64M的swapfile,則:block=64*1024=65536.

然后做如下步驟:

dd if=/dev/zero of=/swapfile bs=1024 count=65536

Setup the swap file with the command:

mkswap /swapfile

To enable the swap file immediately but not automatically at boot time:

swapon /swapfile

To enable it at boot time, edit /etc/fstab to include the following entry:

/swapfile swap swap defaults 0 0

After adding the new swap file and enabling it, verify it is enabled by viewing the output of the command cat /proc/swaps 或者 free.

總結:三種方法都能對swap 分區進行擴展,但是推薦使用第一種方法。

標簽:淘寶邀評 山南 河北 榆林 保定 河池 樂山 滄州

巨人網絡通訊聲明:本文標題《redhat linux swap分區擴展的三種方法詳解》,本文關鍵詞  redhat,linux,swap,分區,擴展,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《redhat linux swap分區擴展的三種方法詳解》相關的同類信息!
  • 本頁收集關于redhat linux swap分區擴展的三種方法詳解的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 方山县| 吴旗县| 铜山县| 丽江市| 同仁县| 岳阳县| 宝清县| 昌黎县| 富裕县| 阿尔山市| 仙桃市| 南乐县| 吴川市| 邯郸市| 泸定县| 永昌县| 剑川县| 雷波县| 渭源县| 诸城市| 廊坊市| 杭锦旗| 安图县| 武陟县| 巩义市| 德江县| 孝义市| 香格里拉县| 衡阳县| 清水县| 梁山县| 内丘县| 青海省| 南部县| 多伦县| 石阡县| 赞皇县| 巧家县| 宜宾市| 衡东县| 信丰县|