Linux 里面发现 swap 分区总共是 1GB 的,为什么服务器软件需要的 300MB 不能直接从 1GB 的 swap 里面取出来用

global_biz2 2014-10-20 02:45:12
Hi,

在 VMware 里面装了一个 Red Hat Linux (Linux version 2.6.18, Red Hat 4.1.2) 系统,里面运行一个服务器软件,当在使用 1GB 内存的时候,系统可以正常启动,也可以正常启动服务器软件,该软件要求最少 300MB 内存才能正常运行。

现在因为有很多个 VM 需要同时运行,于是我将 1GB 改为 256MB 再启动,系统也可以正常启动进到系统,但是,当运行该服务器软件的时候,不能启动。

但是,我在 Linux 里面发现 swap 分区总共是 1GB 的,为什么服务器软件需要的 300MB 不能直接从 1GB 的 swap 里面取出来用??

请指点,谢谢。



...全文
183 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
global_biz 2014-10-21
  • 打赏
  • 举报
回复
引用 9 楼 micropentium6 的回复:
I can't share too much with you at all in terms of English learning coz urs is probably better than me anyway. I can't watch movie without Chinese subtitle. I could be completely lost without subtitle except for some action movies, such as Transformer... ur ssh problem seems weird to me, I would do the following check: 1. Make sure your iptable accepts ssh login (it should be opened by default) 2. Make sure sshd is listening 3. Make sure you connect to the right VM 4, Make sure you use the right password If all three are checked and it still doesn't work, you may have some other software acting as safeguard there and you will have to find it out.
SSH 可以了, 刚才测试了一下,对比了 1GB 与 256MB 的 /var/log/messages, 发现在 256 的时候日志最后一行输出是那个 /bin/bash xxxxxxxxxxxxxxx 启动服务器软件的那一行命令,没有其他出错信息。 请问,如何才能获取到 hang 住的原因的出错信息? 上面测试的时候,是直接在 hang 住的时候直接非正常关闭 vm 的。谢谢。
  • 打赏
  • 举报
回复
引用 8 楼 global_biz 的回复:
[quote=引用 7 楼 micropentium6 的回复:] [quote=引用 6 楼 global_biz 的回复:] [quote=引用 5 楼 micropentium6 的回复:] swap is not equal to memory. As its name indicates, it's designed for swapping in/out data to/from memory. When and what swap occurs depending on the kernel. you only have 256MB physical RAM, kernel could have to keep more important data in the RAM so it lets your application crash. See, if you could find an OOM error message in /var/log/messages
我的英文不是很好,但是你这句话好像有语法错误: it's designed for swapping in/out data from/to memory (正确是 from/to 不是 to/from) 转正题,当 hang 住的时候,我根本无法查看 /var/log/message ,请问有什么好的检查方法,谢谢。 [/quote] well, I would rather consider it as a logical error instead of syntax error. maybe I should have said "swap between memory and disk", how does that sound? Being picky on me can't help you here. I am pretty confident on my English. Thank you for the correction though! If the system hung up, I would try to read the log file after reboot and hopefully it could catch something... as I said, it's really not up to you to decide the behavior of kernel. We both know why system hangs even without reading the log. u really like to know is why... You could though spend couple months to get familiar with kernel, especially the memory management mechanism and algorithms and revisit this issue. [/quote] 请不要介意,我只是在写问题前随便写写,别无他意。 其实我的英文在听方面总有些问题 (读写没问题),例如在看国外电影的时候,没字幕的时候就听得辛苦只听出一部分,但是加上字幕就听上去基本上全部听得懂偶然会有一两个生词。但是不看字幕的时候,那些认识的单词也大部分听不出来。 你的英文这么好,请教下你的英文在听方面是如何练出来了,帮忙指点指点。 ----------------------------------------------------------------------------------------------------------------- 我现在试下测试一下 256 MB 与 1GB 看下 /var/log/message 有什么变化。 但是,有个问题,我用 PuTTY 的 SSH 连不上这台 VM, 我已经在 /etc/ssh/sshd_config 里面把 PermitRootLogin = yes 加了,然后,service restart sshd 后也不行,在 PuTTY 登录的时候,输入了 root 然后输入密码后,提示 Access Denied, 请问是否还有其他文件需要一起改才能 SSH?? [/quote] I can't share too much with you at all in terms of English learning coz urs is probably better than me anyway. I can't watch movie without Chinese subtitle. I could be completely lost without subtitle except for some action movies, such as Transformer... ur ssh problem seems weird to me, I would do the following check: 1. Make sure your iptable accepts ssh login (it should be opened by default) 2. Make sure sshd is listening 3. Make sure you connect to the right VM 4, Make sure you use the right password If all three are checked and it still doesn't work, you may have some other software acting as safeguard there and you will have to find it out.
global_biz 2014-10-21
  • 打赏
  • 举报
回复
引用 7 楼 micropentium6 的回复:
[quote=引用 6 楼 global_biz 的回复:] [quote=引用 5 楼 micropentium6 的回复:] swap is not equal to memory. As its name indicates, it's designed for swapping in/out data to/from memory. When and what swap occurs depending on the kernel. you only have 256MB physical RAM, kernel could have to keep more important data in the RAM so it lets your application crash. See, if you could find an OOM error message in /var/log/messages
我的英文不是很好,但是你这句话好像有语法错误: it's designed for swapping in/out data from/to memory (正确是 from/to 不是 to/from) 转正题,当 hang 住的时候,我根本无法查看 /var/log/message ,请问有什么好的检查方法,谢谢。 [/quote] well, I would rather consider it as a logical error instead of syntax error. maybe I should have said "swap between memory and disk", how does that sound? Being picky on me can't help you here. I am pretty confident on my English. Thank you for the correction though! If the system hung up, I would try to read the log file after reboot and hopefully it could catch something... as I said, it's really not up to you to decide the behavior of kernel. We both know why system hangs even without reading the log. u really like to know is why... You could though spend couple months to get familiar with kernel, especially the memory management mechanism and algorithms and revisit this issue. [/quote] 请不要介意,我只是在写问题前随便写写,别无他意。 其实我的英文在听方面总有些问题 (读写没问题),例如在看国外电影的时候,没字幕的时候就听得辛苦只听出一部分,但是加上字幕就听上去基本上全部听得懂偶然会有一两个生词。但是不看字幕的时候,那些认识的单词也大部分听不出来。 你的英文这么好,请教下你的英文在听方面是如何练出来了,帮忙指点指点。 ----------------------------------------------------------------------------------------------------------------- 我现在试下测试一下 256 MB 与 1GB 看下 /var/log/message 有什么变化。 但是,有个问题,我用 PuTTY 的 SSH 连不上这台 VM, 我已经在 /etc/ssh/sshd_config 里面把 PermitRootLogin = yes 加了,然后,service restart sshd 后也不行,在 PuTTY 登录的时候,输入了 root 然后输入密码后,提示 Access Denied, 请问是否还有其他文件需要一起改才能 SSH??
  • 打赏
  • 举报
回复
引用 6 楼 global_biz 的回复:
[quote=引用 5 楼 micropentium6 的回复:] swap is not equal to memory. As its name indicates, it's designed for swapping in/out data to/from memory. When and what swap occurs depending on the kernel. you only have 256MB physical RAM, kernel could have to keep more important data in the RAM so it lets your application crash. See, if you could find an OOM error message in /var/log/messages
我的英文不是很好,但是你这句话好像有语法错误: it's designed for swapping in/out data from/to memory (正确是 from/to 不是 to/from) 转正题,当 hang 住的时候,我根本无法查看 /var/log/message ,请问有什么好的检查方法,谢谢。 [/quote] well, I would rather consider it as a logical error instead of syntax error. maybe I should have said "swap between memory and disk", how does that sound? Being picky on me can't help you here. I am pretty confident on my English. Thank you for the correction though! If the system hung up, I would try to read the log file after reboot and hopefully it could catch something... as I said, it's really not up to you to decide the behavior of kernel. We both know why system hangs even without reading the log. u really like to know is why... You could though spend couple months to get familiar with kernel, especially the memory management mechanism and algorithms and revisit this issue.
global_biz 2014-10-21
  • 打赏
  • 举报
回复
引用 5 楼 micropentium6 的回复:
swap is not equal to memory. As its name indicates, it's designed for swapping in/out data to/from memory. When and what swap occurs depending on the kernel. you only have 256MB physical RAM, kernel could have to keep more important data in the RAM so it lets your application crash. See, if you could find an OOM error message in /var/log/messages
我的英文不是很好,但是你这句话好像有语法错误: it's designed for swapping in/out data from/to memory (正确是 from/to 不是 to/from) 转正题,当 hang 住的时候,我根本无法查看 /var/log/message ,请问有什么好的检查方法,谢谢。
  • 打赏
  • 举报
回复
swap is not equal to memory. As its name indicates, it's designed for swapping in/out data to/from memory. When and what swap occurs depending on the kernel. you only have 256MB physical RAM, kernel could have to keep more important data in the RAM so it lets your application crash. See, if you could find an OOM error message in /var/log/messages
global_biz2 2014-10-20
  • 打赏
  • 举报
回复
找到上传了,下面的测试的图,请参考:

global_biz2 2014-10-20
  • 打赏
  • 举报
回复
引用 2 楼 Hacker_amos 的回复:
Swap分区在系统的物理内存不够用的时候,把物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临时保存到Swap分区中,等到那些程序要运行时,再从Swap分区中恢复保存的数据到内存中。 swap不能直接当做内存来用
引用 1 楼 erhou134 的回复:
那个软件 是否有验证系统内存大于300M?
我现在做了三个测试,拼成一个图片,但是在 CSDN 的回复里面好像不支持上传附件,如果你们知道如何在回复里面上传附件,请告知,如果没办法的话,只能新开一个贴子来传附件。 这个软件没有验证是否大于 300MB. 为什么不能当内存来使用?那有什么办法在使用 256MB 的时候可以正常运行??(我在三个测试里面,用 free 列出了具体的数值,但现在不知如何上传那个图给大家参考)
hzyd_ 2014-10-20
  • 打赏
  • 举报
回复
Swap分区在系统的物理内存不够用的时候,把物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临时保存到Swap分区中,等到那些程序要运行时,再从Swap分区中恢复保存的数据到内存中。 swap不能直接当做内存来用
空的 2014-10-20
  • 打赏
  • 举报
回复
那个软件 是否有验证系统内存大于300M?

742

社区成员

发帖
与我相关
我的任务
社区描述
该论坛主要探讨Linux系统在IBM Power平台的安装、部署、应用开发等话题,并为网友们提供自由交流的平台。
社区管理员
  • Power Linux社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧