折腾小内存VPS

4,062 views次阅读
没有评论

之前用的VPS 内存一般都大于512M,最近因为翻墙需要购入一些小内存VPS。单纯安装SS 其实用不了多少内存,多出来的不用又觉得浪费。。。

 

干掉 SendMail 进程

SSH下,输入top命令,再输入M,可以查看运行的各个进程和内存使用率。里面逐一查看,没用的干掉。首先牺牲的是SendMail,我基本用不到它。

 

执行命令:

service sendmail stop

再执行:

chkconfig --list sendmail

显示: sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off

执行:chkconfig --level 2345 sendmail off

这样sendmail被彻底关闭了。

 

或者直接执行命令

ntsysv

取消sendmail选项就可以了。

 

给OpenVZ增加一个可看但不可用的swap

 

  1. #!/bin/bash
  2. SWAP="${1:-512}"
  3. NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0"
  4. umount /proc/meminfo 2> /dev/null
  5. sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo > /etc/fake_meminfo
  6. mount --bind /etc/fake_meminfo /proc/meminfo

保存成a.sh 设成可执行的

chmod +x a.sh

然后执行一下。

./a.sh

再看下free

就有SWAP空间了

 

纯粹意淫@


 

未完待续

正文完
 0
HopoL
版权声明:本站原创文章,由 HopoL 于2015-12-26发表,共计653字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)

HopoL's Blog

文章搜索
最新评论
MickeyDee MickeyDee Thanks for the reply, according to Unraid Dev team, it may happen this year.
Metaldololity Metaldololity Whoa, that's really simple. You just save my time a lot. Thankyou!
HopoL HopoL Since you’ve got the backup, it’s actually pretty simple. Just restore the backup files to your new flash drive, then head over to the /config directory and edit the go file. Look for export UNRAID_GUID=xxxxxxxxxxxxxx and swap it with your new drive's GUID. That should do the trick!
Metaldololity Metaldololity Really apreciate for your fast respond, mate. I actually have the backup of the flashdrive (from regular unraid backup). The problem is, when i search on youtube tutorial about changing the failed flashdrive, the process need some sort of confirmation with an account in unraid (blacklist the old one -> whitelist the new one). Since i have a cracked unraid, i don't know how to register my new flashdrive as the correct one (and the system not asking me for the old failed flashdrive). Thanks in advance
HopoL HopoL Man, that's a tough spot to be in. Regularly backing up your /boot folder is super important for exactly this reason. If you don't have a backup and your flash drive is completely fried, your best bet is to Google some specific recovery guides or check the Unraid forums. There are ways to rebuild your config by identifying your parity and data drives, but it can be a bit of a process. Hope you can get it sorted!