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 分区进行扩展,但是推荐使用第一种方法。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 腾讯音乐人《浪漫火焰(新势力计划合辑 Vol.11)[FLAC/分轨][147.45MB]
- 2024年,哪里还可以玩有趣的魔兽RPG?
- 类银河恶魔城动作游戏《灵魂熔解》已正式登陆Steam
- 国庆七天总票房破20亿!《志愿军》8亿票房超速领跑!
- 绝区零轰隆隆驶向日落任务攻略 怎么完成
- dnf手游浩瀚星海神秘武器介绍 沧海长风武器升级
- 初音未来缤纷舞台国服预约开启 上线时间一览
- s14全球总决赛瑞士轮抽签结果是什么 S14瑞士轮抽签结果详情
- gam是哪个国家的队 s14世界赛gam战队国家赛区介绍
- s14全球世界赛主题是什么 英雄联盟s14世界赛最新主题介绍
- 鉴宝博主半年涨粉1500万 鉴宝成网友新晋电子榨菜
- 重大里程碑!《底特律 化身为人》销量突破1000万套
- 网友总结游戏业界七宗罪厂商:暴食的微软 傲慢的育碧
- 棒棒堂.2007-哪里怕(引进版)【EMI百代】【WAV+CUE】
- 邓丽君.2024-美好世界8CD(日本唱片志限量编号版)【环球】【WAV+CUE】