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

新聞動(dòng)態(tài)

redhat linux swap分區(qū)擴(kuò)展的三種方法詳解

發(fā)布日期:2022-01-02 03:45 | 文章來源:站長(zhǎng)之家

redhat linux swap分區(qū)擴(kuò)展的三種方法

swap 介紹:

當(dāng)物理內(nèi)存占用完了后,當(dāng)系統(tǒng)還需要更多的物理內(nèi)存時(shí),物理內(nèi)存中inactive pages ,就move到swap空間。swap 空間是在位于硬盤上的,因此訪問速度較物理內(nèi)存慢。

當(dāng)機(jī)器的物理內(nèi)存發(fā)生變化時(shí),swap 分區(qū)也要做相應(yīng)的擴(kuò)展:

有三種方法可以對(duì)swap 分區(qū)進(jìn)行擴(kuò)展:

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

二、新建swap 分區(qū),

三、新建swap file,

具體步驟如下:

一、擴(kuò)展正在使用的swap 分區(qū)的邏輯卷

設(shè)定用作swap 分區(qū)的邏輯卷為:/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 分區(qū)

設(shè)定新建的swap 分區(qū)的邏輯卷為:/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

通過此種方式進(jìn)行swap 的擴(kuò)展,首先要計(jì)算出block的數(shù)目。具體為根據(jù)需要擴(kuò)展的swapfile的大小,以M為單位。block=swap分區(qū)大小*1024, 例如,需要擴(kuò)展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.

總結(jié):三種方法都能對(duì)swap 分區(qū)進(jìn)行擴(kuò)展,但是推薦使用第一種方法。

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

實(shí)時(shí)開通

自選配置、實(shí)時(shí)開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對(duì)1客戶咨詢顧問

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部