大网数据广告活动
服务器运维问答

linux redhat + swapoff is stuck not return prompt

· 52CE 我爱测

I do the following steps in order to increase the swap size but when I start with swapoff /dev/mapper/rootvg-swap , then its stuck for along time and not return the prompt why we can do to solve this swapoff /dev/mapper/rootvg-sw…

问题原文

原帖链接 · King David · CC BY-SA 3.0

I do the following steps in order to increase the swap size

but when I start with swapoff /dev/mapper/rootvg-swap , then its stuck for along time and not return the prompt

why we can do to solve this

 swapoff /dev/mapper/rootvg-swap
 lvresize -L +5g  /dev/mapper/rootvg-swap
 mkswap /dev/mapper/rootvg-swap
 swapon /dev/mapper/rootvg-swap


 vmstat 1
 procs -----------memory---------- ---swap-- -----io---- --system-- ----- cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0 2027848 127788  28804 18490972  105   38   180   211   25   59 17  6 64 13  0
 1  0 2027848 126944  28812 18490972    0    0     0   124 1073 1491 16  1  82  1  0
 0  0 2027848 126076  28828 18490956    0    0     0   104  727 1236  6  0    94  0  0
 0  0 2027848 126076  28828 18491008    0    0     0     0  452  979  2  0 98  0  0
 1  0 2027696 130960  28828 18486500  480    0   480    92  985 1415 21  4 69  5  0
 0  0 2027696 130984  28844 18486572    0    0     0    43  421  984  1  0 98  1  0

社区高分解答

原帖链接 · Peter Evans · CC BY-SA 4.0

I experienced this problem recently on a Centos 7 VM. I stopped and started swapoff several times because I was impatient and thought "nothing was happening".

On the last effort I tried running swapon --show on a separate terminal a few minutes apart and saw that the amount of swap being used was reducing, albeit at a snail's pace - i.e. 1.5MB/s, so it took about an hour and a quarter to finish as about 6.5GB were in swap - although there was plenty of main memory available. Eventually it finished successfully.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-11-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。