首页 > 其他 > 详细

Swap故障一例

时间:2018-03-15 16:15:42      阅读:362      评论:0      收藏:0      [点我收藏+]
错误:swapoff: /dev/dm-1: swapoff failed: Cannot allocate memory

解决方法:

[root@jrgc ~]# swapon -s
Filename                                Type                 Size         Used     Priority
/dev/dm-1                              partition            3145724       1524700    -1
[root@jrgc ~]# swapoff /dev/dm-1
swapoff: /dev/dm-1: swapoff failed: Cannot allocate memory
[root@jrgc home]# dd if=/dev/zero of=/home/swap bs=1024 count=512000
512000+0 records in
512000+0 records out
524288000 bytes (524 MB) copied, 1.2637 s, 415 MB/s
[root@jrgc home]# mkswap /home/swap
mkswap: /home/swap: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 511996 KiB
no label, UUID=155bb4be-29cb-4e95-9581-24e11be6188f
[root@jrgc home]# swapon /home/swap
[root@jrgc home]# free -m
                    total       used       free     shared    buffers     cached
Mem:                 3832       3550       282          0          4        166
-/+ buffers/cache:   3378       453
Swap:                3571       1495       2076
[root@jrgc home]# swapoff /dev/dm-1
[root@jrgc ~]# free -m
                    total       used       free     shared    buffers     cached
Mem:                 3832       3711        120          0          2         19
-/+ buffers/cache:   3689       143
Swap:                499        499          0
[root@jrgc home]# swapon /dev/dm-1
[root@jrgc home]# free -m
                    total       used       free     shared    buffers     cached
Mem:                3832       3717        114          0          1        25
-/+ buffers/cache:  3691       140
Swap:               3571       495         3076
[root@jrgc home]# swapoff /home/swap
[root@jrgc home]# free -m           
                    total       used       free     shared    buffers     cached
Mem:                3832       3725        106          0          0              15
-/+ buffers/cache:  3710       122
Swap:               3071       476         2595


 

Swap故障一例

原文:http://blog.51cto.com/stuart/2087188

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!