谢谢,是OpenVZ的,这几天看了些资料,OpenVZ确实不能添加swap。<div>系统是用的Debian,Nginx+php5-fpm+mysql</div><div>也优化了,但是内存还是200MB以上,很容易out of memory。不知道别人的几十M怎么来的。<br><br><div class="gmail_quote">在 2011年1月17日 下午5:16,Shellexy <span dir="ltr"><<a href="mailto:jhuangjiahua@gmail.com">jhuangjiahua@gmail.com</a>></span>写道:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2011/1/11 Lanpice Lio <<a href="mailto:ghosthk21@gmail.com">ghosthk21@gmail.com</a>><br>
<div class="im"><br>
> 前两天入手了一台VPS,内存只有256MB,没有swap,便想自己添加一个swap文件用。<br>
> 但是swapon 的时候出现了swapon failed: Operation not permitted<br>
> 操作不允许,我是root啊。<br>
> 另外通过修改fstab,也无法启用。<br>
> 为了确保操作无误,我又做了一遍,还是不行。到自己系统上却很顺利的添加了。<br>
> 去google之,发现有这种情况的无一例外全部是在VPS上的。<br>
> 各位碰到过这种情况吗?有解吗?<br>
> 谢谢。<br>
><br>
<br>
</div>你估计是用的 OpenVZ 虚拟化技术的 VPS,<br>
OpenVZ 使用 Host 分配内存,不需要 SWAP。<br>
<br>
那么请 google openvz vps,<br>
你先前 google 的关键词可能错了。<br>
<br>
你跑一个 WP 就用掉 200M 内存,<br>
估计是用的 apache 而非现在流行的轻巧的 nginx + spawn-fcgi/php5-fpm。<br>
<br>
如果没其他情况就先这样用了别换了吧,买了机器不压榨干净不浪费嘛。<br>
想要练手或有其他计划就考虑换下 nginx + php5-fpm 比较好,<br>
想折腾还可以考虑让 wp 用 sqlite 替换掉 mysql (不更好,只是省资源)<br>
<br>
其实 256M 不算小内存了, 不过也是可以看看 小内存 VPS 优化建议 (LNMP+WordPress 环境)<br>
<<a href="http://wowubuntu.com/vps-optimize.html" target="_blank">http://wowubuntu.com/vps-optimize.html</a>><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110117/522038ae/attachment.html" target="_blank">https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110117/522038ae/attachment.html</a>><br>
<div><div></div><div class="h5">--<br>
ubuntu-zh mailing list<br>
<a href="mailto:ubuntu-zh@lists.ubuntu.com">ubuntu-zh@lists.ubuntu.com</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><span></span><span></span><font color="#993399"><b><font face="simhei, sans-serif" size="1"><u>签名神马的都是浮云……</u></font></b></font><div><font color="#993399" face="simhei, sans-serif" size="1"><b><u><br>
</u></b></font></div><div><font face="simhei, sans-serif" size="1"><b><u><a href="http://lcan.info" target="_blank">我的BLOG</a></u></b></font></div><div><div><font color="#993399"><font face="simhei, sans-serif" size="1"><u><b>Twitter: <a href="http://www.twitter.com/lcayu" target="_blank">@lcayu</a></b></u></font></font></div>
<div><font size="1"><font color="#993399"><font face="simhei, sans-serif"><u><b></b></u></font></font><span style="color:rgb(119, 119, 119);font-style:italic;line-height:18px"><font face="simhei, sans-serif">Linux fan,Ubuntu,KDE,IT小白,SSH翻墙控,裸考帝,犬夜叉迷,步迷,就读于天朝某号称国际化,信息化大学,关注Linux应用,网络与信息安全,ayu,及一切扯淡!求fo!</font></span></font></div>
<div><font color="#993399"><font face="simhei, sans-serif" size="1"><u><b>Facebook: <a href="http://www.facebook.com/ghosthk" target="_blank">欢迎访问</a></b></u></font></font></div></div><br>
</div>