redhatlinuxswap分區(qū)擴(kuò)展的示例分析-創(chuàng)新互聯(lián)

這篇文章主要為大家展示了“redhat linux swap分區(qū)擴(kuò)展的示例分析”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“redhat linux swap分區(qū)擴(kuò)展的示例分析”這篇文章吧。

成都創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元托里做網(wǎng)站,已為上家服務(wù),為托里各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:13518219792

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

swap 介紹:

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

通過(guò)此種方式進(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.

以上是“redhat linux swap分區(qū)擴(kuò)展的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)頁(yè)標(biāo)題:redhatlinuxswap分區(qū)擴(kuò)展的示例分析-創(chuàng)新互聯(lián)
文章路徑:http://muchs.cn/article24/cddjje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)云服務(wù)器、微信公眾號(hào)、搜索引擎優(yōu)化虛擬主機(jī)、電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)