空间占用过高解决方案
1 简介
1.1 Linux的swap原理
# cat /proc/sys/vm/swappiness60
2 解决
2.1 调整swappiness参数
2.1.1 临时调整
# sysctl vm.swappiness=10vm.swappiness = 10# cat /proc/sys/vm/swappiness10
2.1.2 久调整
# cat /etc/sysctl.confvm.swappiness=10
#sysctl -p
2.2 增加swap空间
# free -mtotal used free shared buff/cache availableMem: 3791 1464 1112 30 1214 1998Swap: 4095 175 3920
# df -h /dev/zeroFilesystem Size Used Avail Use% Mounted ondevtmpfs 1.9G 0 1.9G 0% /dev
# cd /home/# mkdir -p swap# cd /home/swap/# dd if=/dev/zero of=swapfile bs=1M count=10241024+0 records in1024+0 records out1073741824 bytes (1.1 GB) copied, 1.0867 s, 988 MB/s
# mkswap swapfileSetting up swapspace version 1, size = 1048572 KiBno label, UUID=18c17ff6-a584-4e74-8fba-ab0a39ae90e4
# swapon swapfileswapon: /home/swap/swapfile: insecure permissions 0644, 0600 suggested.
# free -mtotal used free shared buff/cache availableMem: 3791 1464 121 30 2205 1989Swap: 5119 175 4944
#vi /etc/fstab/home/swap/swapfile swap swapdefaults 0 0
作者:橡皮24
链接:https://www.jianshu.com/p/dbc27148f58c
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。