位置: 编程技术 - 正文

redhat linux swap分区扩展的三种方法详解(linux-swap)

编辑:rootadmin

推荐整理分享redhat linux swap分区扩展的三种方法详解(linux-swap),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:linux-swap,linux swapon,redhat7增加swap,redhat swap大小,linux-swap,linux-swap,redhat swap大小,redhat swap大小,内容如对您有帮助,希望把文章链接给更多的朋友!

redhat linux swap分区扩展的三种方法

swap 介绍:

当物理内存占用完了后,当系统还需要更多的物理内存时,物理内存中inactive pages ,就move到swap空间。swap 空间是在位于硬盘上的,因此访问速度较物理内存慢。

当机器的物理内存发生变化时,swap 分区也要做相应的扩展:

有三种方法可以对swap 分区进行扩展:

一、扩展正在使用的swap 分区的逻辑卷(推荐使用此种方式)

二、新建swap 分区,

三、新建swap file,

具体步骤如下:

一、扩展正在使用的swap 分区的逻辑卷

设定用作swap 分区的逻辑卷为:/dev/VolGroup/LogVol

Disable swapping for the associated logical volume:

# swapoff -v /dev/VolGroup/LogVol

Resize the LVM2 logical volume by MB:

# lvm lvresize /dev/VolGroup/LogVol -L +M

Format the new swap space:

# mkswap /dev/VolGroup/LogVol

Enable the extended logical volume:

# swapon -va

Test that the logical volume has been extended properly:

# cat /proc/swaps 或者# free

二、新建swap 分区

redhat linux swap分区扩展的三种方法详解(linux-swap)

设定新建的swap 分区的逻辑卷为:/dev/VolGroup/LogVol

Create the LVM2 logical volume of size MB:

# lvm lvcreate VolGroup -n LogVol -L M

Format the new swap space:

# mkswap /dev/VolGroup/LogVol

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

/dev/VolGroup/LogVol 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分区大小*, 例如,需要扩展M的swapfile,则:block=*=.

然后做如下步骤:

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

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 分区进行扩展,但是推荐使用第一种方法。

在Linux平台下分析死锁问题的方法 死锁(deallocks):是指两个或两个以上的进程(线程)在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去。

linux下普通文件和目录文件区别详解 文件权限一般可认为是,一共十位:0:表示该文件的文件类型。Windows里面是使用了一种文件关联的技术,通过扩展名来关联相应的应用程序,

Linux用户alias文件配置方法 修改~/.bashrc文件,以配置用户自己定义的alias$vi~/.bashrc显示#.bash_profile#Getthealiasesandfunctionsif[-f~/.bashrc];then.~/.bashrcfi#UserspecificenvironmentandstartupprogramsPATH=$P

本文链接地址:https://www.jiuchutong.com/biancheng/361983.html 转载请保留说明!

上一篇:Linux chroot命令用法详解(linux charon)

下一篇:在Linux平台下分析死锁问题的方法(linux必不可少的分区)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络