linux swap 分区调控(swap分区 lvm管理)
注:linux swap分区 采用lvm管理,调控可以采用下面的方法
一.查看 swap lv
[root@testdb ~]# vgdisplay -v
Finding all volume groups
Finding volume group "VolGroup"
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 357.38 GiB
PE Size 4.00 MiB
Total PE 91489
Alloc PE / Size 34512 / 134.81 GiB
Free PE / Size 56977 / 222.57 GiB
VG UUID q6q2yf-Isfw-DnkL-JeSN-uTvC-l5m2-M0HEco
--- Logical volume ---
LV Path /dev/VolGroup/lv_root
LV Name lv_root
VG Name VolGroup
LV UUID 0nFC6x-BsP2-7w0r-8bPV-Vw9j-whIz-EWj5Ba
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-09-16 08:41:58 +0800
LV Status available
# open 1
LV Size 29.30 GiB
Current LE 7500
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/VolGroup/lv_swap
LV Name lv_swap
VG Name VolGroup
LV UUID OJaxbf-MPay-cjep-L44c-UKDx-ZmGW-v24yUf
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-09-16 08:42:00 +0800
LV Status available
# open 2
LV Size 7.86 GiB
Current LE 2012
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
--- Logical volume ---
LV Path /dev/VolGroup/lv_home
LV Name lv_home
VG Name VolGroup
LV UUID HZvOuv-G8NW-2ZyW-3Ffl-H54i-Kmjp-8ndVqo
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-09-16 08:42:01 +0800
LV Status available
# open 1
LV Size 97.66 GiB
Current LE 25000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2
--- Physical volumes ---
PV Name /dev/sda2
PV UUID gQvj3L-kOPV-LILA-KPnD-a8W9-lgdE-09vtlQ
PV Status allocatable
Total PE / Free PE 91489 / 56977
swap 分区 lv 为/dev/VolGroup/lv_swap
二.扩大swap分区
关闭交换分区
[root@testdb ~]# swapoff /dev/VolGroup/lv_swap
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 14682 1398 0 83 13680
-/+ buffers/cache: 919 15162
Swap: 0 0 0
扩展 /dev/VolGroup/lv_swap,增加8336M
[root@testdb ~]# lvextend -L +8336M /dev/VolGroup/lv_swap
Extending logical volume lv_swap to 16.28 GiB
Logical volume lv_swap successfully resized
将 /dev/VolGroup/lv_swap 设置为swap分区
[root@testdb ~]# mkswap /dev/VolGroup/lv_swap
mkswap: /dev/VolGroup/lv_swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 17072124 KiB
no label, UUID=f5fa0e85-da9e-440c-8f1c-e3ab978c9d6b
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 14683 1398 0 83 13680
-/+ buffers/cache: 918 15162
Swap: 0 0 0
启动swap分区
[root@testdb ~]# swapon /dev/VolGroup/lv_swap
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 14695 1386 0 83 13680
-/+ buffers/cache: 931 15150
Swap: 16671 0 16671
三.减小swap分区
关闭交换分区
[root@testdb ~]# swapoff /dev/VolGroup/lv_swap
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 15141 940 0 255 13953
-/+ buffers/cache: 932 15149
Swap: 0 0 0
减小 /dev/VolGroup/lv_swap 8000M
[root@testdb ~]# lvreduce -L -8000M /dev/VolGroup/lv_swap
WARNING: Reducing active logical volume to 8.47 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_swap? [y/n]: y
Reducing logical volume lv_swap to 8.47 GiB
Logical volume lv_swap successfully resized
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 15143 938 0 256 13955
-/+ buffers/cache: 931 15149
Swap: 0 0 0
将 /dev/VolGroup/lv_swap 设置为swap分区
[root@testdb ~]# mkswap /dev/VolGroup/lv_swap
mkswap: /dev/VolGroup/lv_swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 8880124 KiB
no label, UUID=1951f318-e2eb-45d5-b1ed-25a2bf87adea
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 15142 938 0 256 13955
-/+ buffers/cache: 931 15150
Swap: 0 0 0
开启swap分区
[root@testdb ~]# swapon /dev/VolGroup/lv_swap
[root@testdb ~]# free -m
total used free shared buffers cached
Mem: 16081 15149 932 0 256 13955
-/+ buffers/cache: 937 15143
Swap: 8671 0 8671
[root@testdb ~]#
linux swap 分区调控(swap分区 lvm管理)的更多相关文章
- LVM 管理减少swap分区空间增加到根分区
简介 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它是Linux环境下对磁盘分区进行管理的一种机制,它由Heinz Mauelshagen在Linux 2.4内核上实现 ...
- 为linux系统添加虚拟内存swap分区
阿铭linux学习笔记之swap分区 一.作用: swap分区是交换分区,在系统物理内存不足时与swap进行交换,对web服务器的性能影响极大,通过调整swap分区大小来提升服务器的性能,节省资源费用 ...
- 《RHEL6硬盘的分区和swap分区管理》——硬盘分区的大总结
首先介绍下几个简单的命令: free查看当前系统内存的使用情况 查看分区的使用情况:T类型.H显示大小以G,M 查看系统所有硬盘的分区信息:分区的没分区的都显示出来了 开始分区:为什么要加cu 不加 ...
- linux两种增加交换分区(swap)的方法
在安装Oracle后,为使Oracle流畅运行,需要手动增加linux的交换分区(相当于Windows下的虚拟内存)的大小,本文介绍两种增加交换分区(swap)的方法. 第一种方法:新建分区 1.fd ...
- LINUX新建和增加SWAP分区
我们都知道在安装Linux系统时在分区时可以分配swap分区,而系统安装后(在运行中)如何建立或调整swap分区呢? 在装完Linux系统之后,建立Swap分区有两种方法. 1.新建磁盘分区作为swa ...
- 阿里云服务器linux主机如何添加swap分区
为什么要添加Swap分区?swap分区,即交换区,作用为:当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,以供当前运行的程序使用.那些被释放的空间可能来自一些很长时间没有什么操作 ...
- [转]LINUX新建和增加SWAP分区
以前做过增加swap分区的事情,今天一个同事问到我如何做,故记个笔记整理一下吧.另外,以前我写过“交换分区swap的大小分配”,大家也可先看一下. 我们都知道在安装Linux系统时在分区时可以分配sw ...
- Linux 如何重新划分Swap交换分区
SWAP分区是LINUX暂时存储数据的交换分区,它主要是把主内存上暂时不用得数据存起来,在需要的时候再调进内存内,且作为SWAP使用的分区不用指定“MoutPoint”(载入点)它至少要等于系统上实际 ...
- Linux系统实现虚拟内存有两种方法:交换分区(swap分区)和交换文件
Linux系统实现虚拟内存有两种方法:交换分区(swap分区)和交换文件 交换文件 查看内存:free -m , -m是显示单位为MB,-g单位GB 创建一个文件:touch /root/swapfi ...
随机推荐
- png透明图片
2. JS处理 使用DD_belatedPNG(http://www.dillerdesign.com/experiment/DD_belatedPNG/),可以很简单的对界面上所有的透明图片进行同一 ...
- perl HTML::TreeBuilder::XPath
HTML::TreeBuilder::XPath 添加XPath 支持HTML::TreeBuilder use HTML::TreeBuilder::XPath; my $tree= HTML: ...
- bzoj1650 [Usaco2006 Dec]River Hopscotch 跳石子
Description Every year the cows hold an event featuring a peculiar version of hopscotch that involve ...
- Google API v3 设置Icon问题处理
1.查看API实现 //虽然比较符合API实现的思想但这个没法; //会产生Uncaught TypeError: undefined is not a function //google API n ...
- BFS visit tree
There are two ways to conduct BFS on tree. Solution 1 -- Given level Use recursion to find given lev ...
- UML_活动图
一.活动图的组成元素 Activity Diagram Element 1.活动状态图(Activity) 2.动作状态(Actions) 3.动作状态约束(Action Constraints) 4 ...
- 重大新闻:借贷宝不用绑卡了,借贷宝APP推出肖像识别新功能!
动动手指,20元人民币立即到手:http://www.cnblogs.com/mfryf/p/4754384.html 滴滴打车烧钱十几个亿,狂送打车券,很多人天天免费坐车! 去年年初百度钱包注册奖励 ...
- hdu 1078 FatMouse and Cheese 记忆化dp
只能横向或竖向走...一次横着竖着最多k步...不能转弯的.... 为毛我的500+ms才跑出来... #include<cstdio> #include<iostream> ...
- Android 学习笔记(一)
环境配置在网上搜索的一大堆. 这里简单发几个连接. http://jingyan.baidu.com/article/bea41d437a41b6b4c51be6c1.html http://jing ...
- Android系统休眠对程序的影响以及处理
Android系统在用户长时间不操作时,为了节省资源,系统会选择休眠.在休眠过程中自定义的Timer.Handler.Thread.Service等都会暂停.而有时候这种机制会影响到我们程序的正常运行 ...